2023-09-11 18:52:07 +01:00
|
|
|
local DateTime = require("@lune/DateTime")
|
|
|
|
|
2023-09-16 05:24:05 +01:00
|
|
|
local values = DateTime.fromIsoDate("2023-08-27T05:54:19Z"):toLocalTime()
|
2023-09-11 18:52:07 +01:00
|
|
|
|
|
|
|
local expectedDateTimeValues = os.date("*t", 1693115659)
|
|
|
|
|
|
|
|
assert(
|
2023-09-16 05:24:05 +01:00
|
|
|
values.year == expectedDateTimeValues.year,
|
|
|
|
`expected {values.year} == {expectedDateTimeValues.year}`
|
2023-09-11 18:52:07 +01:00
|
|
|
)
|
|
|
|
assert(
|
2023-09-16 05:24:05 +01:00
|
|
|
values.month == expectedDateTimeValues.month,
|
|
|
|
`expected {values.month} == {expectedDateTimeValues.month}`
|
2023-09-11 18:52:07 +01:00
|
|
|
)
|
|
|
|
assert(
|
2023-09-16 05:24:05 +01:00
|
|
|
values.day == expectedDateTimeValues.day,
|
|
|
|
`expected {values.day} == {expectedDateTimeValues.day}`
|
2023-09-11 18:52:07 +01:00
|
|
|
)
|
|
|
|
assert(
|
2023-09-16 05:24:05 +01:00
|
|
|
values.hour == expectedDateTimeValues.hour,
|
|
|
|
`expected {values.hour} == {expectedDateTimeValues.hour}`
|
2023-09-11 18:52:07 +01:00
|
|
|
)
|
|
|
|
assert(
|
2023-09-16 05:24:05 +01:00
|
|
|
values.minute == expectedDateTimeValues.min,
|
|
|
|
`expected {values.minute} == {expectedDateTimeValues.min}`
|
2023-09-11 18:52:07 +01:00
|
|
|
)
|
|
|
|
assert(
|
2023-09-16 05:24:05 +01:00
|
|
|
values.second == expectedDateTimeValues.sec,
|
|
|
|
`expected {values.second} == {expectedDateTimeValues.sec}`
|
2023-09-11 18:52:07 +01:00
|
|
|
)
|