Skip to content

Commit

Permalink
Create DateTime.php
Browse files Browse the repository at this point in the history
  • Loading branch information
milwad-dev committed Sep 2, 2024
1 parent 2114cc6 commit 00ab13a
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/Provider/fa_IR/DateTime.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace Faker\Provider\fa_IR;

class DateTime extends \Faker\Provider\DateTime
{
public static function dayOfWeek($max = 'now')
{
$map = [
'Sunday' => 'یکشنبه',
'Monday' => 'دوشنبه',
'Tuesday' => 'سه شنبه',
'Wednesday' => 'چهارشنبه',
'Thursday' => 'پنج شنبه',
'Friday' => 'جمعه',
'Saturday' => 'شنبه',
];
$week = static::dateTime($max)->format('l');

return $map[$week] ?? $week;
}

public static function monthName($max = 'now')
{
$map = [
'January' => 'دی',
'February' => 'بهمن',
'March' => 'اسفند',
'April' => 'فروردین',
'May' => 'اردیبهشت',
'June' => 'خرداد',
'July' => 'تیر',
'August' => 'مرداد',
'September' => 'شهریور',
'October' => 'مهر',
'November' => 'آبان',
'December' => 'آذر',
];
$month = static::dateTime($max)->format('F');

return $map[$month] ?? $month;
}
}

0 comments on commit 00ab13a

Please sign in to comment.