mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 13:00:37 +00:00
30 lines
914 B
Lua
30 lines
914 B
Lua
local DateTime = require("@lune/DateTime")
|
|
|
|
local dateTime = (DateTime.fromIsoDate("2023-08-27T05:54:19Z") :: DateTime.DateTime):toLocalTime()
|
|
|
|
local expectedDateTimeValues = os.date("*t", 1693115659)
|
|
|
|
assert(
|
|
dateTime.year == expectedDateTimeValues.year,
|
|
`expected {dateTime.year} == {expectedDateTimeValues.year}`
|
|
)
|
|
assert(
|
|
dateTime.month == expectedDateTimeValues.month,
|
|
`expected {dateTime.month} == {expectedDateTimeValues.month}`
|
|
)
|
|
assert(
|
|
dateTime.day == expectedDateTimeValues.day,
|
|
`expected {dateTime.day} == {expectedDateTimeValues.day}`
|
|
)
|
|
assert(
|
|
dateTime.hour == expectedDateTimeValues.hour,
|
|
`expected {dateTime.hour} == {expectedDateTimeValues.hour}`
|
|
)
|
|
assert(
|
|
dateTime.minute == expectedDateTimeValues.min,
|
|
`expected {dateTime.minute} == {expectedDateTimeValues.min}`
|
|
)
|
|
assert(
|
|
dateTime.second == expectedDateTimeValues.sec,
|
|
`expected {dateTime.second} == {expectedDateTimeValues.sec}`
|
|
)
|