@@ -98,7 +98,7 @@ describe('DateDiffGreaterThanOrEqualToAssert', () => {
98
98
99
99
it ( 'should throw an error if the diff between `fromDate` and input date is less than the `threshold`' , ( ) => {
100
100
try {
101
- new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 * 60 * 60 * 1000 , { fromDate : new Date ( '1970-01-01 00:00:00 ' ) } ) . validate ( new Date ( '1970-01-01 10:00:00 ' ) ) ;
101
+ new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 * 60 * 60 * 1000 , { fromDate : new Date ( '1970-01-01' ) } ) . validate ( new Date ( '1970-01-01 10:00:00Z ' ) ) ;
102
102
103
103
should . fail ( ) ;
104
104
} catch ( e ) {
@@ -156,7 +156,7 @@ describe('DateDiffGreaterThanOrEqualToAssert', () => {
156
156
157
157
it ( 'should use the `asFloat` option supplied' , ( ) => {
158
158
try {
159
- new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 5 , { asFloat : true , fromDate : new Date ( '1970-01-01 10:00:00 ' ) , unit : 'minutes' } ) . validate ( new Date ( '1970-01-01 10:04:51 ' ) ) ;
159
+ new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 5 , { asFloat : true , fromDate : new Date ( '1970-01-01 10:00:00Z ' ) , unit : 'minutes' } ) . validate ( new Date ( '1970-01-01 10:04:51Z ' ) ) ;
160
160
161
161
should . fail ( ) ;
162
162
} catch ( e ) {
@@ -167,7 +167,7 @@ describe('DateDiffGreaterThanOrEqualToAssert', () => {
167
167
168
168
it ( 'should use the `unit` option supplied' , ( ) => {
169
169
try {
170
- new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 2000 , { fromDate : new Date ( '1970-01-01 10:00:00 ' ) , unit : 'seconds' } ) . validate ( new Date ( '1970-01-01 10:00:05 ' ) ) ;
170
+ new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 2000 , { fromDate : new Date ( '1970-01-01 10:00:00Z ' ) , unit : 'seconds' } ) . validate ( new Date ( '1970-01-01 10:00:05Z ' ) ) ;
171
171
172
172
should . fail ( ) ;
173
173
} catch ( e ) {
@@ -178,48 +178,48 @@ describe('DateDiffGreaterThanOrEqualToAssert', () => {
178
178
it ( 'should accept a date whose diff from `now` is equal to the threshold' , ( ) => {
179
179
const clock = sinon . useFakeTimers ( 0 , 'Date' ) ;
180
180
181
- new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 * 60 * 60 * 1000 ) . validate ( new Date ( '1969-12-31 00:00:00 ' ) ) ;
181
+ new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 * 60 * 60 * 1000 ) . validate ( new Date ( '1969-12-31' ) ) ;
182
182
183
183
clock . restore ( ) ;
184
184
} ) ;
185
185
186
186
it ( 'should accept a date whose diff from `now` is greater than the threshold' , ( ) => {
187
187
const clock = sinon . useFakeTimers ( 0 , 'Date' ) ;
188
188
189
- new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 * 60 * 60 * 1000 ) . validate ( new Date ( '1969-12-30 00:00:00 ' ) ) ;
189
+ new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 * 60 * 60 * 1000 ) . validate ( new Date ( '1969-12-30' ) ) ;
190
190
191
191
clock . restore ( ) ;
192
192
} ) ;
193
193
194
194
it ( 'should accept a date whose `absolute` diff from `now` is equal to the threshold' , ( ) => {
195
195
const clock = sinon . useFakeTimers ( 0 , 'Date' ) ;
196
196
197
- new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 * 60 * 60 * 1000 , { absolute : true } ) . validate ( new Date ( '1970-01-02 00:00:00 ' ) ) ;
197
+ new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 * 60 * 60 * 1000 , { absolute : true } ) . validate ( new Date ( '1970-01-02' ) ) ;
198
198
199
199
clock . restore ( ) ;
200
200
} ) ;
201
201
202
202
it ( 'should accept a date whose `absolute` diff from `now` is greater than the threshold' , ( ) => {
203
203
const clock = sinon . useFakeTimers ( 0 , 'Date' ) ;
204
204
205
- new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 * 60 * 60 * 1000 , { absolute : true } ) . validate ( new Date ( '1970-01-03 00:00:00 ' ) ) ;
205
+ new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 * 60 * 60 * 1000 , { absolute : true } ) . validate ( new Date ( '1970-01-03' ) ) ;
206
206
207
207
clock . restore ( ) ;
208
208
} ) ;
209
209
210
210
it ( 'should accept a date whose diff from `fromDate` is equal to the threshold' , ( ) => {
211
- new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 , { asFloat : false , fromDate : new Date ( '1970-01-01 00:00:00 ' ) , unit : 'hours' } ) . validate ( new Date ( '1969-12-31 00:00:00 ' ) ) ;
211
+ new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 , { asFloat : false , fromDate : new Date ( '1970-01-01' ) , unit : 'hours' } ) . validate ( new Date ( '1969-12-31' ) ) ;
212
212
} ) ;
213
213
214
214
it ( 'should accept a date whose diff from `fromDate` is greater than the threshold' , ( ) => {
215
- new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 , { asFloat : false , fromDate : new Date ( '1970-01-01 00:00:00 ' ) , unit : 'hours' } ) . validate ( new Date ( '1969-12-30 00:00:00 ' ) ) ;
215
+ new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 , { asFloat : false , fromDate : new Date ( '1970-01-01' ) , unit : 'hours' } ) . validate ( new Date ( '1969-12-30' ) ) ;
216
216
} ) ;
217
217
218
218
it ( 'should accept a date whose `absolute` diff from `fromDate` is equal to the threshold' , ( ) => {
219
- new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 , { absolute : true , asFloat : false , fromDate : new Date ( '1970-01-01 00:00:00 ' ) , unit : 'hours' } ) . validate ( new Date ( '1970-01-02 00:00:00 ' ) ) ;
219
+ new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 , { absolute : true , asFloat : false , fromDate : new Date ( '1970-01-01' ) , unit : 'hours' } ) . validate ( new Date ( '1970-01-02' ) ) ;
220
220
} ) ;
221
221
222
222
it ( 'should accept a date whose `absolute` diff from `fromDate` is greater than the threshold' , ( ) => {
223
- new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 , { absolute : true , asFloat : false , fromDate : new Date ( '1970-01-01 00:00:00 ' ) , unit : 'hours' } ) . validate ( new Date ( '1970-01-03 00:00:00 ' ) ) ;
223
+ new Assert ( ) . DateDiffGreaterThanOrEqualTo ( 24 , { absolute : true , asFloat : false , fromDate : new Date ( '1970-01-01' ) , unit : 'hours' } ) . validate ( new Date ( '1970-01-03' ) ) ;
224
224
} ) ;
225
225
} ) ;
0 commit comments