Skip to content

Commit 00ab13a

Browse files
committed
Create DateTime.php
1 parent 2114cc6 commit 00ab13a

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

src/Provider/fa_IR/DateTime.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace Faker\Provider\fa_IR;
4+
5+
class DateTime extends \Faker\Provider\DateTime
6+
{
7+
public static function dayOfWeek($max = 'now')
8+
{
9+
$map = [
10+
'Sunday' => 'یکشنبه',
11+
'Monday' => 'دوشنبه',
12+
'Tuesday' => 'سه شنبه',
13+
'Wednesday' => 'چهارشنبه',
14+
'Thursday' => 'پنج شنبه',
15+
'Friday' => 'جمعه',
16+
'Saturday' => 'شنبه',
17+
];
18+
$week = static::dateTime($max)->format('l');
19+
20+
return $map[$week] ?? $week;
21+
}
22+
23+
public static function monthName($max = 'now')
24+
{
25+
$map = [
26+
'January' => 'دی',
27+
'February' => 'بهمن',
28+
'March' => 'اسفند',
29+
'April' => 'فروردین',
30+
'May' => 'اردیبهشت',
31+
'June' => 'خرداد',
32+
'July' => 'تیر',
33+
'August' => 'مرداد',
34+
'September' => 'شهریور',
35+
'October' => 'مهر',
36+
'November' => 'آبان',
37+
'December' => 'آذر',
38+
];
39+
$month = static::dateTime($max)->format('F');
40+
41+
return $map[$month] ?? $month;
42+
}
43+
}

0 commit comments

Comments
 (0)