aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/vlib/time/Y2K38_test.v
blob: 0ebc0ef92b00f33027601b7bb578aee3d1dcd1cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import time

fn test_time_after_2038_works() {
	after_time := time.parse_iso8601('2037-07-23') or { time.now() }
	dump(after_time)
	error_time := after_time.add_days(180)
	dump(error_time)
	assert error_time.str() == '2038-01-19 00:00:00'
	// NB: the next date is after Y2K38, it should NOT wrap:
	error_time2 := after_time.add_days(181)
	dump(error_time2)
	assert error_time2.str() == '2038-01-20 00:00:00'
}