diff --git a/package.json b/package.json index 4ae0104d4..0b6d70217 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "types": "index.d.ts", "module": "./src/index.js", "scripts": { - "test": "jest && TZ=Pacific/Auckland npm run test-tz && TZ=Europe/London npm run test-tz && npm run test-tz", + "test": "TZ=Pacific/Auckland npm run test-tz && TZ=Europe/London npm run test-tz && npm run test-tz && jest", "test-tz": "jest test/timezone.test --coverage=false", "lint": "./node_modules/.bin/eslint src/* test/* build/*", "build": "cross-env BABEL_ENV=build node build && npm run size", diff --git a/src/locale/es-do.js b/src/locale/es-do.js index 434584ecd..4b4ccb42b 100644 --- a/src/locale/es-do.js +++ b/src/locale/es-do.js @@ -7,6 +7,7 @@ const locale = { weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'), months: 'Enero_Febrero_Marzo_Abril_Mayo_Junio_Julio_Agosto_Septiembre_Octubre_Noviembre_Diciembre'.split('_'), monthsShort: 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'), + weekStart: 1, relativeTime: { future: 'en %s', past: 'hace %s', diff --git a/src/locale/es.js b/src/locale/es.js index e39e4b175..fb76b51c0 100644 --- a/src/locale/es.js +++ b/src/locale/es.js @@ -7,6 +7,7 @@ const locale = { weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'), months: 'Enero_Febrero_Marzo_Abril_Mayo_Junio_Julio_Agosto_Septiembre_Octubre_Noviembre_Diciembre'.split('_'), + weekStart: 1, formats: { LT: 'H:mm', LTS: 'H:mm:ss', diff --git a/test/locale/keys.test.js b/test/locale/keys.test.js index 85746e524..1e65d1e24 100644 --- a/test/locale/keys.test.js +++ b/test/locale/keys.test.js @@ -23,7 +23,8 @@ it('Locale keys', () => { relativeTime, weekdaysShort, monthsShort, - weekdaysMin + weekdaysMin, + weekStart } = l expect(name).toEqual(expect.any(String)) expect(weekdays).toEqual(expect.any(Array)) @@ -31,6 +32,7 @@ it('Locale keys', () => { if (weekdaysShort) expect(weekdaysShort).toEqual(expect.any(Array)) if (monthsShort) expect(monthsShort).toEqual(expect.any(Array)) if (weekdaysMin) expect(weekdaysMin).toEqual(expect.any(Array)) + if (weekStart) expect(weekStart).toEqual(expect.any(Number)) expect(months).toEqual(expect.any(Array)) // function pass date return string or number or null diff --git a/test/manipulate.test.js b/test/manipulate.test.js index fd5cb72d1..ae0c8fec9 100644 --- a/test/manipulate.test.js +++ b/test/manipulate.test.js @@ -2,6 +2,7 @@ import moment from 'moment' import MockDate from 'mockdate' import dayjs from '../src' import '../src/locale/zh-cn' +import '../src/locale/ar' beforeEach(() => { MockDate.set(new Date()) @@ -31,7 +32,11 @@ describe('StartOf EndOf', () => { }) it('StartOf week with locale', () => { - expect(dayjs().locale('zh-cn').startOf('week').format()).toBe(moment().locale('zh-cn').startOf('week').format()) + const testArr = ['zh-cn'] + testArr.forEach((l) => { + expect(dayjs().locale(l).startOf('week').date()).toBe(moment().locale(l).startOf('week').date()) + expect(dayjs().locale(l).endOf('week').date()).toBe(moment().locale(l).endOf('week').date()) + }) }) })