Skip to content

Commit

Permalink
fix: update locale ar-* meridiem function (iamkun#1954)
Browse files Browse the repository at this point in the history
  • Loading branch information
notoriousmango authored Jun 27, 2022
1 parent 36662dc commit 3d31611
Show file tree
Hide file tree
Showing 14 changed files with 168 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/locale/ar-dz.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const locale = {
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd D MMMM YYYY HH:mm'
},
meridiem: hour => (hour > 12 ? 'ص' : 'م'),
meridiem: hour => (hour > 12 ? 'م' : 'ص'),
relativeTime: {
future: 'في %s',
past: 'منذ %s',
Expand Down
2 changes: 1 addition & 1 deletion src/locale/ar-iq.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const locale = {
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd D MMMM YYYY HH:mm'
},
meridiem: hour => (hour > 12 ? 'ص' : 'م'),
meridiem: hour => (hour > 12 ? 'م' : 'ص'),
relativeTime: {
future: 'في %s',
past: 'منذ %s',
Expand Down
2 changes: 1 addition & 1 deletion src/locale/ar-kw.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const locale = {
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd D MMMM YYYY HH:mm'
},
meridiem: hour => (hour > 12 ? 'ص' : 'م'),
meridiem: hour => (hour > 12 ? 'م' : 'ص'),
relativeTime: {
future: 'في %s',
past: 'منذ %s',
Expand Down
2 changes: 1 addition & 1 deletion src/locale/ar-ly.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const locale = {
monthsShort: 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
ordinal: n => n,
meridiem: hour => (hour > 12 ? 'ص' : 'م'),
meridiem: hour => (hour > 12 ? 'م' : 'ص'),
formats: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
Expand Down
2 changes: 1 addition & 1 deletion src/locale/ar-ma.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const locale = {
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd D MMMM YYYY HH:mm'
},
meridiem: hour => (hour > 12 ? 'ص' : 'م'),
meridiem: hour => (hour > 12 ? 'م' : 'ص'),
relativeTime: {
future: 'في %s',
past: 'منذ %s',
Expand Down
2 changes: 1 addition & 1 deletion src/locale/ar-sa.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const locale = {
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd D MMMM YYYY HH:mm'
},
meridiem: hour => (hour > 12 ? 'ص' : 'م'),
meridiem: hour => (hour > 12 ? 'م' : 'ص'),
relativeTime: {
future: 'في %s',
past: 'منذ %s',
Expand Down
2 changes: 1 addition & 1 deletion src/locale/ar-tn.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const locale = {
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd D MMMM YYYY HH:mm'
},
meridiem: hour => (hour > 12 ? 'ص' : 'م'),
meridiem: hour => (hour > 12 ? 'م' : 'ص'),
relativeTime: {
future: 'في %s',
past: 'منذ %s',
Expand Down
23 changes: 23 additions & 0 deletions test/locale/ar-dz.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import MockDate from 'mockdate'
import dayjs from '../../src'
import relativeTime from '../../src/plugin/relativeTime'
import '../../src/locale/ru'
import locale from '../../src/locale/ar-dz'

dayjs.extend(relativeTime)

beforeEach(() => {
MockDate.set(new Date())
})

afterEach(() => {
MockDate.reset()
})

it('Meridiem', () => {
dayjs.locale(locale)
expect(dayjs('2020-01-01 03:00:00').locale('ar-dz').format('A')).toEqual('ص')
expect(dayjs('2020-01-01 11:00:00').locale('ar-dz').format('A')).toEqual('ص')
expect(dayjs('2020-01-01 16:00:00').locale('ar-dz').format('A')).toEqual('م')
expect(dayjs('2020-01-01 20:00:00').locale('ar-dz').format('A')).toEqual('م')
})
23 changes: 23 additions & 0 deletions test/locale/ar-iq.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import MockDate from 'mockdate'
import dayjs from '../../src'
import relativeTime from '../../src/plugin/relativeTime'
import '../../src/locale/ru'
import locale from '../../src/locale/ar-iq'

dayjs.extend(relativeTime)

beforeEach(() => {
MockDate.set(new Date())
})

afterEach(() => {
MockDate.reset()
})

it('Meridiem', () => {
dayjs.locale(locale)
expect(dayjs('2020-01-01 03:00:00').locale('ar-iq').format('A')).toEqual('ص')
expect(dayjs('2020-01-01 11:00:00').locale('ar-iq').format('A')).toEqual('ص')
expect(dayjs('2020-01-01 16:00:00').locale('ar-iq').format('A')).toEqual('م')
expect(dayjs('2020-01-01 20:00:00').locale('ar-iq').format('A')).toEqual('م')
})
23 changes: 23 additions & 0 deletions test/locale/ar-kw.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import MockDate from 'mockdate'
import dayjs from '../../src'
import relativeTime from '../../src/plugin/relativeTime'
import '../../src/locale/ru'
import locale from '../../src/locale/ar-kw'

dayjs.extend(relativeTime)

beforeEach(() => {
MockDate.set(new Date())
})

afterEach(() => {
MockDate.reset()
})

it('Meridiem', () => {
dayjs.locale(locale)
expect(dayjs('2020-01-01 03:00:00').locale('ar-kw').format('A')).toEqual('ص')
expect(dayjs('2020-01-01 11:00:00').locale('ar-kw').format('A')).toEqual('ص')
expect(dayjs('2020-01-01 16:00:00').locale('ar-kw').format('A')).toEqual('م')
expect(dayjs('2020-01-01 20:00:00').locale('ar-kw').format('A')).toEqual('م')
})
23 changes: 23 additions & 0 deletions test/locale/ar-ly.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import MockDate from 'mockdate'
import dayjs from '../../src'
import relativeTime from '../../src/plugin/relativeTime'
import '../../src/locale/ru'
import locale from '../../src/locale/ar-ly'

dayjs.extend(relativeTime)

beforeEach(() => {
MockDate.set(new Date())
})

afterEach(() => {
MockDate.reset()
})

it('Meridiem', () => {
dayjs.locale(locale)
expect(dayjs('2020-01-01 03:00:00').locale('ar-ly').format('A')).toEqual('ص')
expect(dayjs('2020-01-01 11:00:00').locale('ar-ly').format('A')).toEqual('ص')
expect(dayjs('2020-01-01 16:00:00').locale('ar-ly').format('A')).toEqual('م')
expect(dayjs('2020-01-01 20:00:00').locale('ar-ly').format('A')).toEqual('م')
})
23 changes: 23 additions & 0 deletions test/locale/ar-ma.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import MockDate from 'mockdate'
import dayjs from '../../src'
import relativeTime from '../../src/plugin/relativeTime'
import '../../src/locale/ru'
import locale from '../../src/locale/ar-ma'

dayjs.extend(relativeTime)

beforeEach(() => {
MockDate.set(new Date())
})

afterEach(() => {
MockDate.reset()
})

it('Meridiem', () => {
dayjs.locale(locale)
expect(dayjs('2020-01-01 03:00:00').locale('ar-ma').format('A')).toEqual('ص')
expect(dayjs('2020-01-01 11:00:00').locale('ar-ma').format('A')).toEqual('ص')
expect(dayjs('2020-01-01 16:00:00').locale('ar-ma').format('A')).toEqual('م')
expect(dayjs('2020-01-01 20:00:00').locale('ar-ma').format('A')).toEqual('م')
})
23 changes: 23 additions & 0 deletions test/locale/ar-sa.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import MockDate from 'mockdate'
import dayjs from '../../src'
import relativeTime from '../../src/plugin/relativeTime'
import '../../src/locale/ru'
import locale from '../../src/locale/ar-sa'

dayjs.extend(relativeTime)

beforeEach(() => {
MockDate.set(new Date())
})

afterEach(() => {
MockDate.reset()
})

it('Meridiem', () => {
dayjs.locale(locale)
expect(dayjs('2020-01-01 03:00:00').locale('ar-sa').format('A')).toEqual('ص')
expect(dayjs('2020-01-01 11:00:00').locale('ar-sa').format('A')).toEqual('ص')
expect(dayjs('2020-01-01 16:00:00').locale('ar-sa').format('A')).toEqual('م')
expect(dayjs('2020-01-01 20:00:00').locale('ar-sa').format('A')).toEqual('م')
})
23 changes: 23 additions & 0 deletions test/locale/ar-tn.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import MockDate from 'mockdate'
import dayjs from '../../src'
import relativeTime from '../../src/plugin/relativeTime'
import '../../src/locale/ru'
import locale from '../../src/locale/ar-tn'

dayjs.extend(relativeTime)

beforeEach(() => {
MockDate.set(new Date())
})

afterEach(() => {
MockDate.reset()
})

it('Meridiem', () => {
dayjs.locale(locale)
expect(dayjs('2020-01-01 03:00:00').locale('ar-tn').format('A')).toEqual('ص')
expect(dayjs('2020-01-01 11:00:00').locale('ar-tn').format('A')).toEqual('ص')
expect(dayjs('2020-01-01 16:00:00').locale('ar-tn').format('A')).toEqual('م')
expect(dayjs('2020-01-01 20:00:00').locale('ar-tn').format('A')).toEqual('م')
})

0 comments on commit 3d31611

Please sign in to comment.