File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 2
2
import dayjs from 'dayjs'
3
3
4
4
const months = 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر' . split ( '_' )
5
+
5
6
const symbolMap = {
6
7
1 : '١' ,
7
8
2 : '٢' ,
@@ -36,6 +37,7 @@ const locale = {
36
37
months,
37
38
monthsShort : months ,
38
39
weekStart : 6 ,
40
+ meridiem : hour => ( hour > 12 ? 'م' : 'ص' ) ,
39
41
relativeTime : {
40
42
future : 'بعد %s' ,
41
43
past : 'منذ %s' ,
Original file line number Diff line number Diff line change @@ -50,3 +50,13 @@ it('RelativeTime: Time from X gets formatted', () => {
50
50
. toBe ( t [ 2 ] )
51
51
} )
52
52
} )
53
+
54
+ it ( 'Format meridiem with locale function' , ( ) => {
55
+ for ( let i = 0 ; i <= 23 ; i += 1 ) {
56
+ const hour = dayjs ( )
57
+ . startOf ( 'day' )
58
+ . add ( i , 'hour' )
59
+ const meridiem = i > 12 ? 'م' : 'ص'
60
+ expect ( hour . locale ( 'ar' ) . format ( 'A' ) ) . toBe ( `${ meridiem } ` )
61
+ }
62
+ } )
You can’t perform that action at this time.
0 commit comments