Skip to content

Commit 66e42ec

Browse files
committed
fix: update es es-do locale adding weekStart && update weekStart test
1 parent 1295591 commit 66e42ec

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"types": "index.d.ts",
77
"module": "./src/index.js",
88
"scripts": {
9-
"test": "jest && TZ=Pacific/Auckland npm run test-tz && TZ=Europe/London npm run test-tz && npm run test-tz",
9+
"test": "TZ=Pacific/Auckland npm run test-tz && TZ=Europe/London npm run test-tz && npm run test-tz && jest",
1010
"test-tz": "jest test/timezone.test --coverage=false",
1111
"lint": "./node_modules/.bin/eslint src/* test/* build/*",
1212
"build": "cross-env BABEL_ENV=build node build && npm run size",

src/locale/es-do.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const locale = {
77
weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'),
88
months: 'Enero_Febrero_Marzo_Abril_Mayo_Junio_Julio_Agosto_Septiembre_Octubre_Noviembre_Diciembre'.split('_'),
99
monthsShort: 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'),
10+
weekStart: 1,
1011
relativeTime: {
1112
future: 'en %s',
1213
past: 'hace %s',

src/locale/es.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const locale = {
77
weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
88
weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'),
99
months: 'Enero_Febrero_Marzo_Abril_Mayo_Junio_Julio_Agosto_Septiembre_Octubre_Noviembre_Diciembre'.split('_'),
10+
weekStart: 1,
1011
formats: {
1112
LT: 'H:mm',
1213
LTS: 'H:mm:ss',

test/locale/keys.test.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@ it('Locale keys', () => {
2323
relativeTime,
2424
weekdaysShort,
2525
monthsShort,
26-
weekdaysMin
26+
weekdaysMin,
27+
weekStart
2728
} = l
2829
expect(name).toEqual(expect.any(String))
2930
expect(weekdays).toEqual(expect.any(Array))
3031

3132
if (weekdaysShort) expect(weekdaysShort).toEqual(expect.any(Array))
3233
if (monthsShort) expect(monthsShort).toEqual(expect.any(Array))
3334
if (weekdaysMin) expect(weekdaysMin).toEqual(expect.any(Array))
35+
if (weekStart) expect(weekStart).toEqual(expect.any(Number))
3436

3537
expect(months).toEqual(expect.any(Array))
3638
// function pass date return string or number or null

test/manipulate.test.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import moment from 'moment'
22
import MockDate from 'mockdate'
33
import dayjs from '../src'
44
import '../src/locale/zh-cn'
5+
import '../src/locale/ar'
56

67
beforeEach(() => {
78
MockDate.set(new Date())
@@ -31,7 +32,11 @@ describe('StartOf EndOf', () => {
3132
})
3233

3334
it('StartOf week with locale', () => {
34-
expect(dayjs().locale('zh-cn').startOf('week').format()).toBe(moment().locale('zh-cn').startOf('week').format())
35+
const testArr = ['zh-cn']
36+
testArr.forEach((l) => {
37+
expect(dayjs().locale(l).startOf('week').date()).toBe(moment().locale(l).startOf('week').date())
38+
expect(dayjs().locale(l).endOf('week').date()).toBe(moment().locale(l).endOf('week').date())
39+
})
3540
})
3641
})
3742

0 commit comments

Comments
 (0)