@@ -268,27 +268,35 @@ func TestFormatScaledTime(t *testing.T) {
268
268
require .Equal (t , "toDateTime('2022-01-12 15:00:00')" , val )
269
269
val , _ = format (t1 .Location (), Seconds , t1 .In (time .Now ().Location ()))
270
270
require .Equal (t , "toDateTime('1641999600')" , val )
271
+ val , _ = format (t1 .Location (), Seconds , time .Unix (0 , 0 ))
272
+ require .Equal (t , "toDateTime(0)" , val )
271
273
val , _ = format (tz , Seconds , t1 )
272
274
require .Equal (t , "toDateTime('2022-01-12 15:00:00', 'UTC')" , val )
273
275
// milliseconds
274
276
val , _ = format (t1 .Location (), MilliSeconds , t1 )
275
277
require .Equal (t , "toDateTime64('2022-01-12 15:00:00.123', 3)" , val )
276
278
val , _ = format (t1 .Location (), MilliSeconds , t1 .In (time .Now ().Location ()))
277
279
require .Equal (t , "toDateTime64('1641999600123', 3)" , val )
280
+ val , _ = format (t1 .Location (), MilliSeconds , time .Unix (0 , 0 ))
281
+ require .Equal (t , "toDateTime(0)" , val )
278
282
val , _ = format (tz , MilliSeconds , t1 )
279
283
require .Equal (t , "toDateTime64('2022-01-12 15:00:00.123', 3, 'UTC')" , val )
280
284
// microseconds
281
285
val , _ = format (t1 .Location (), MicroSeconds , t1 )
282
286
require .Equal (t , "toDateTime64('2022-01-12 15:00:00.123456', 6)" , val )
283
287
val , _ = format (t1 .Location (), MicroSeconds , t1 .In (time .Now ().Location ()))
284
288
require .Equal (t , "toDateTime64('1641999600123456', 6)" , val )
289
+ val , _ = format (t1 .Location (), MicroSeconds , time .Unix (0 , 0 ))
290
+ require .Equal (t , "toDateTime(0)" , val )
285
291
val , _ = format (tz , MicroSeconds , t1 )
286
292
require .Equal (t , "toDateTime64('2022-01-12 15:00:00.123456', 6, 'UTC')" , val )
287
293
// nanoseconds
288
294
val , _ = format (t1 .Location (), NanoSeconds , t1 )
289
295
require .Equal (t , "toDateTime64('2022-01-12 15:00:00.123456789', 9)" , val )
290
296
val , _ = format (t1 .Location (), NanoSeconds , t1 .In (time .Now ().Location ()))
291
297
require .Equal (t , "toDateTime64('1641999600123456789', 9)" , val )
298
+ val , _ = format (t1 .Location (), NanoSeconds , time .Unix (0 , 0 ))
299
+ require .Equal (t , "toDateTime(0)" , val )
292
300
val , _ = format (tz , NanoSeconds , t1 )
293
301
require .Equal (t , "toDateTime64('2022-01-12 15:00:00.123456789', 9, 'UTC')" , val )
294
302
}
0 commit comments