2021-08-04 13:12:02 +03:00
|
|
|
import time
|
|
|
|
|
2022-09-21 19:45:43 +03:00
|
|
|
fn test_add_to_day_in_the_previous_century() {
|
2022-10-26 11:26:28 +03:00
|
|
|
a := time.parse_iso8601('1900-01-01')!
|
2021-08-04 13:12:02 +03:00
|
|
|
aa := a.add_days(180)
|
2022-05-15 10:55:24 +03:00
|
|
|
assert aa.ymmdd() == '1900-06-30'
|
2021-08-04 13:12:02 +03:00
|
|
|
}
|
|
|
|
|
2022-09-21 19:45:43 +03:00
|
|
|
fn test_add_to_day_in_the_past() {
|
2022-10-26 11:26:28 +03:00
|
|
|
a := time.parse_iso8601('1990-03-01')!
|
2021-08-04 13:12:02 +03:00
|
|
|
aa := a.add_days(180)
|
2022-05-15 10:55:24 +03:00
|
|
|
assert aa.ymmdd() == '1990-08-28'
|
2021-08-04 13:12:02 +03:00
|
|
|
}
|
|
|
|
|
2022-09-21 19:45:43 +03:00
|
|
|
fn test_add_to_day_in_the_recent_past() {
|
2022-10-26 11:26:28 +03:00
|
|
|
a := time.parse_iso8601('2021-03-01')!
|
2021-08-04 13:12:02 +03:00
|
|
|
aa := a.add_days(180)
|
|
|
|
assert aa.ymmdd() == '2021-08-28'
|
|
|
|
}
|
|
|
|
|
2022-09-21 19:45:43 +03:00
|
|
|
fn test_add_to_day_in_the_future_1() {
|
2022-10-26 11:26:28 +03:00
|
|
|
a := time.parse_iso8601('3000-11-01')!
|
2021-08-04 13:12:02 +03:00
|
|
|
aa := a.add_days(180)
|
2023-08-05 23:41:23 +03:00
|
|
|
dump(a.debug())
|
|
|
|
dump(aa.debug())
|
2021-08-04 13:12:02 +03:00
|
|
|
assert aa.ymmdd() == '3001-04-30'
|
|
|
|
}
|
|
|
|
|
2022-09-21 19:45:43 +03:00
|
|
|
fn test_add_to_day_in_the_future_2() {
|
2022-10-26 11:26:28 +03:00
|
|
|
a := time.parse_iso8601('3000-12-30')!
|
2021-08-04 13:12:02 +03:00
|
|
|
aa := a.add_days(180)
|
|
|
|
assert aa.ymmdd() == '3001-06-28'
|
|
|
|
}
|