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