File tree 5 files changed +12
-3
lines changed
5 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 6
6
"types" : " index.d.ts" ,
7
7
"module" : " ./src/index.js" ,
8
8
"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 " ,
10
10
"test-tz" : " jest test/timezone.test --coverage=false" ,
11
11
"lint" : " ./node_modules/.bin/eslint src/* test/* build/*" ,
12
12
"build" : " cross-env BABEL_ENV=build node build && npm run size" ,
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ const locale = {
7
7
weekdaysMin : 'do_lu_ma_mi_ju_vi_sá' . split ( '_' ) ,
8
8
months : 'Enero_Febrero_Marzo_Abril_Mayo_Junio_Julio_Agosto_Septiembre_Octubre_Noviembre_Diciembre' . split ( '_' ) ,
9
9
monthsShort : 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic' . split ( '_' ) ,
10
+ weekStart : 1 ,
10
11
relativeTime : {
11
12
future : 'en %s' ,
12
13
past : 'hace %s' ,
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ const locale = {
7
7
weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.' . split ( '_' ) ,
8
8
weekdaysMin : 'do_lu_ma_mi_ju_vi_sá' . split ( '_' ) ,
9
9
months : 'Enero_Febrero_Marzo_Abril_Mayo_Junio_Julio_Agosto_Septiembre_Octubre_Noviembre_Diciembre' . split ( '_' ) ,
10
+ weekStart : 1 ,
10
11
formats : {
11
12
LT : 'H:mm' ,
12
13
LTS : 'H:mm:ss' ,
Original file line number Diff line number Diff line change @@ -23,14 +23,16 @@ it('Locale keys', () => {
23
23
relativeTime,
24
24
weekdaysShort,
25
25
monthsShort,
26
- weekdaysMin
26
+ weekdaysMin,
27
+ weekStart
27
28
} = l
28
29
expect ( name ) . toEqual ( expect . any ( String ) )
29
30
expect ( weekdays ) . toEqual ( expect . any ( Array ) )
30
31
31
32
if ( weekdaysShort ) expect ( weekdaysShort ) . toEqual ( expect . any ( Array ) )
32
33
if ( monthsShort ) expect ( monthsShort ) . toEqual ( expect . any ( Array ) )
33
34
if ( weekdaysMin ) expect ( weekdaysMin ) . toEqual ( expect . any ( Array ) )
35
+ if ( weekStart ) expect ( weekStart ) . toEqual ( expect . any ( Number ) )
34
36
35
37
expect ( months ) . toEqual ( expect . any ( Array ) )
36
38
// function pass date return string or number or null
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import moment from 'moment'
2
2
import MockDate from 'mockdate'
3
3
import dayjs from '../src'
4
4
import '../src/locale/zh-cn'
5
+ import '../src/locale/ar'
5
6
6
7
beforeEach ( ( ) => {
7
8
MockDate . set ( new Date ( ) )
@@ -31,7 +32,11 @@ describe('StartOf EndOf', () => {
31
32
} )
32
33
33
34
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
+ } )
35
40
} )
36
41
} )
37
42
You can’t perform that action at this time.
0 commit comments