forked from fzaninotto/Faker
-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2114cc6
commit 00ab13a
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |