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 22import dayjs from 'dayjs'
33
44const months = 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر' . split ( '_' )
5+
56const symbolMap = {
67 1 : '١' ,
78 2 : '٢' ,
@@ -36,6 +37,7 @@ const locale = {
3637 months,
3738 monthsShort : months ,
3839 weekStart : 6 ,
40+ meridiem : hour => ( hour > 12 ? 'م' : 'ص' ) ,
3941 relativeTime : {
4042 future : 'بعد %s' ,
4143 past : 'منذ %s' ,
Original file line number Diff line number Diff line change @@ -50,3 +50,13 @@ it('RelativeTime: Time from X gets formatted', () => {
5050 . toBe ( t [ 2 ] )
5151 } )
5252} )
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