@@ -86,7 +86,7 @@ describe('DateTimeInput', () => {
86
86
} ) ;
87
87
88
88
it ( 'shows a given date in all inputs correctly given Date (12-hour format)' , ( ) => {
89
- const date = new Date ( 2017 , 8 , 30 , 22 , 17 , 0 ) ;
89
+ const date = new Date ( 2017 , 8 , 30 , 22 , 17 , 3 ) ;
90
90
91
91
const { container } = render (
92
92
< DateTimeInput { ...defaultProps } maxDetail = "second" value = { date } /> ,
@@ -95,17 +95,17 @@ describe('DateTimeInput', () => {
95
95
const nativeInput = container . querySelector ( 'input[type="datetime-local"]' ) ;
96
96
const customInputs = container . querySelectorAll ( 'input[data-input]' ) ;
97
97
98
- expect ( nativeInput ) . toHaveValue ( '2017-09-30T22:17' ) ;
98
+ expect ( nativeInput ) . toHaveValue ( '2017-09-30T22:17:03 ' ) ;
99
99
expect ( customInputs [ 0 ] ) . toHaveValue ( 9 ) ;
100
100
expect ( customInputs [ 1 ] ) . toHaveValue ( 30 ) ;
101
101
expect ( customInputs [ 2 ] ) . toHaveValue ( 2017 ) ;
102
102
expect ( customInputs [ 3 ] ) . toHaveValue ( 10 ) ;
103
103
expect ( customInputs [ 4 ] ) . toHaveValue ( 17 ) ;
104
- expect ( customInputs [ 5 ] ) . toHaveValue ( 0 ) ;
104
+ expect ( customInputs [ 5 ] ) . toHaveValue ( 3 ) ;
105
105
} ) ;
106
106
107
107
it ( 'shows a given date in all inputs correctly given ISO string (12-hour format)' , ( ) => {
108
- const date = '2017-09-30T22:17:00 .000' ;
108
+ const date = '2017-09-30T22:17:03 .000' ;
109
109
110
110
const { container } = render (
111
111
< DateTimeInput { ...defaultProps } maxDetail = "second" value = { date } /> ,
@@ -114,17 +114,17 @@ describe('DateTimeInput', () => {
114
114
const nativeInput = container . querySelector ( 'input[type="datetime-local"]' ) ;
115
115
const customInputs = container . querySelectorAll ( 'input[data-input]' ) ;
116
116
117
- expect ( nativeInput ) . toHaveValue ( '2017-09-30T22:17' ) ;
117
+ expect ( nativeInput ) . toHaveValue ( '2017-09-30T22:17:03 ' ) ;
118
118
expect ( customInputs [ 0 ] ) . toHaveValue ( 9 ) ;
119
119
expect ( customInputs [ 1 ] ) . toHaveValue ( 30 ) ;
120
120
expect ( customInputs [ 2 ] ) . toHaveValue ( 2017 ) ;
121
121
expect ( customInputs [ 3 ] ) . toHaveValue ( 10 ) ;
122
122
expect ( customInputs [ 4 ] ) . toHaveValue ( 17 ) ;
123
- expect ( customInputs [ 5 ] ) . toHaveValue ( 0 ) ;
123
+ expect ( customInputs [ 5 ] ) . toHaveValue ( 3 ) ;
124
124
} ) ;
125
125
126
126
itIfFullICU ( 'shows a given date in all inputs correctly given Date (24-hour format)' , ( ) => {
127
- const date = new Date ( 2017 , 8 , 30 , 22 , 17 , 0 ) ;
127
+ const date = new Date ( 2017 , 8 , 30 , 22 , 17 , 3 ) ;
128
128
129
129
const { container } = render (
130
130
< DateTimeInput { ...defaultProps } locale = "de-DE" maxDetail = "second" value = { date } /> ,
@@ -133,19 +133,19 @@ describe('DateTimeInput', () => {
133
133
const nativeInput = container . querySelector ( 'input[type="datetime-local"]' ) ;
134
134
const customInputs = container . querySelectorAll ( 'input[data-input]' ) ;
135
135
136
- expect ( nativeInput ) . toHaveValue ( '2017-09-30T22:17' ) ;
136
+ expect ( nativeInput ) . toHaveValue ( '2017-09-30T22:17:03 ' ) ;
137
137
expect ( customInputs [ 0 ] ) . toHaveValue ( 30 ) ;
138
138
expect ( customInputs [ 1 ] ) . toHaveValue ( 9 ) ;
139
139
expect ( customInputs [ 2 ] ) . toHaveValue ( 2017 ) ;
140
140
expect ( customInputs [ 3 ] ) . toHaveValue ( 22 ) ;
141
141
expect ( customInputs [ 4 ] ) . toHaveValue ( 17 ) ;
142
- expect ( customInputs [ 5 ] ) . toHaveValue ( 0 ) ;
142
+ expect ( customInputs [ 5 ] ) . toHaveValue ( 3 ) ;
143
143
} ) ;
144
144
145
145
itIfFullICU (
146
146
'shows a given date in all inputs correctly given ISO string (24-hour format)' ,
147
147
( ) => {
148
- const date = '2017-09-30T22:17:00 .000' ;
148
+ const date = '2017-09-30T22:17:03 .000' ;
149
149
150
150
const { container } = render (
151
151
< DateTimeInput { ...defaultProps } locale = "de-DE" maxDetail = "second" value = { date } /> ,
@@ -154,13 +154,13 @@ describe('DateTimeInput', () => {
154
154
const nativeInput = container . querySelector ( 'input[type="datetime-local"]' ) ;
155
155
const customInputs = container . querySelectorAll ( 'input[data-input]' ) ;
156
156
157
- expect ( nativeInput ) . toHaveValue ( '2017-09-30T22:17' ) ;
157
+ expect ( nativeInput ) . toHaveValue ( '2017-09-30T22:17:03 ' ) ;
158
158
expect ( customInputs [ 0 ] ) . toHaveValue ( 30 ) ;
159
159
expect ( customInputs [ 1 ] ) . toHaveValue ( 9 ) ;
160
160
expect ( customInputs [ 2 ] ) . toHaveValue ( 2017 ) ;
161
161
expect ( customInputs [ 3 ] ) . toHaveValue ( 22 ) ;
162
162
expect ( customInputs [ 4 ] ) . toHaveValue ( 17 ) ;
163
- expect ( customInputs [ 5 ] ) . toHaveValue ( 0 ) ;
163
+ expect ( customInputs [ 5 ] ) . toHaveValue ( 3 ) ;
164
164
} ,
165
165
) ;
166
166
@@ -182,7 +182,7 @@ describe('DateTimeInput', () => {
182
182
} ) ;
183
183
184
184
it ( 'clears the value correctly' , ( ) => {
185
- const date = new Date ( 2017 , 8 , 30 , 22 , 17 , 0 ) ;
185
+ const date = new Date ( 2017 , 8 , 30 , 22 , 17 , 3 ) ;
186
186
187
187
const { container, rerender } = render (
188
188
< DateTimeInput { ...defaultProps } maxDetail = "second" value = { date } /> ,
@@ -704,7 +704,7 @@ describe('DateTimeInput', () => {
704
704
705
705
it ( 'triggers onChange correctly when cleared custom inputs' , ( ) => {
706
706
const onChange = vi . fn ( ) ;
707
- const date = new Date ( 2017 , 8 , 30 , 22 , 17 , 0 ) ;
707
+ const date = new Date ( 2017 , 8 , 30 , 22 , 17 , 3 ) ;
708
708
709
709
const { container } = render (
710
710
< DateTimeInput { ...defaultProps } maxDetail = "second" onChange = { onChange } value = { date } /> ,
@@ -722,45 +722,45 @@ describe('DateTimeInput', () => {
722
722
723
723
it ( 'triggers onChange correctly when changed native input' , ( ) => {
724
724
const onChange = vi . fn ( ) ;
725
- const date = new Date ( 2017 , 8 , 30 , 22 , 17 , 0 ) ;
725
+ const date = new Date ( 2017 , 8 , 30 , 22 , 17 , 3 ) ;
726
726
727
727
const { container } = render (
728
728
< DateTimeInput { ...defaultProps } onChange = { onChange } value = { date } /> ,
729
729
) ;
730
730
731
731
const nativeInput = container . querySelector ( 'input[type="datetime-local"]' ) as HTMLInputElement ;
732
732
733
- fireEvent . change ( nativeInput , { target : { value : '2017-09-30T20:17:00 ' } } ) ;
733
+ fireEvent . change ( nativeInput , { target : { value : '2017-09-30T20:17:03 ' } } ) ;
734
734
735
735
expect ( onChange ) . toHaveBeenCalled ( ) ;
736
- expect ( onChange ) . toHaveBeenCalledWith ( new Date ( 2017 , 8 , 30 , 20 , 17 , 0 ) , false ) ;
736
+ expect ( onChange ) . toHaveBeenCalledWith ( new Date ( 2017 , 8 , 30 , 20 , 17 , 3 ) , false ) ;
737
737
} ) ;
738
738
739
739
it ( 'triggers onChange correctly when changed native input with year < 100' , ( ) => {
740
740
const onChange = vi . fn ( ) ;
741
741
const date = new Date ( ) ;
742
742
date . setFullYear ( 19 , 8 , 20 ) ;
743
- date . setHours ( 22 , 17 , 0 , 0 ) ;
743
+ date . setHours ( 22 , 17 , 3 , 0 ) ;
744
744
745
745
const { container } = render (
746
746
< DateTimeInput { ...defaultProps } onChange = { onChange } value = { date } /> ,
747
747
) ;
748
748
749
749
const nativeInput = container . querySelector ( 'input[type="datetime-local"]' ) as HTMLInputElement ;
750
750
751
- fireEvent . change ( nativeInput , { target : { value : '0019-09-20T20:17:00 ' } } ) ;
751
+ fireEvent . change ( nativeInput , { target : { value : '0019-09-20T20:17:03 ' } } ) ;
752
752
753
753
const nextDate = new Date ( ) ;
754
754
nextDate . setFullYear ( 19 , 8 , 20 ) ;
755
- nextDate . setHours ( 20 , 17 , 0 , 0 ) ;
755
+ nextDate . setHours ( 20 , 17 , 3 , 0 ) ;
756
756
757
757
expect ( onChange ) . toHaveBeenCalled ( ) ;
758
758
expect ( onChange ) . toHaveBeenCalledWith ( nextDate , false ) ;
759
759
} ) ;
760
760
761
761
it ( 'triggers onChange correctly when cleared native input' , ( ) => {
762
762
const onChange = vi . fn ( ) ;
763
- const date = new Date ( 2017 , 8 , 30 , 22 , 17 , 0 ) ;
763
+ const date = new Date ( 2017 , 8 , 30 , 22 , 17 , 3 ) ;
764
764
765
765
const { container } = render (
766
766
< DateTimeInput { ...defaultProps } onChange = { onChange } value = { date } /> ,
0 commit comments