Title. Type DateTime can’t be converted to a number using tonumber
print(tonumber(DateTime.now())) -- nil
Strange, because DateTime.now() returns a unix timestamp, which seemingly has no reason to not be able to convert to a number, given that a unix timestap is just a number.
It would somewhat make sense if it just wasn’t able to convert to anything because it also has properties, such as UnixTimestampMillis, however, they can convert to a string using tostring just fine, and the doc for DateTime even mentions that.
This does allow for a workaround to this, which is just:
print(tonumber(tostring(DateTime.now()))) -- Returns the current unix timestamp as a number
Not sure if there’s some kind of internal limitation that only allows for string conversions to work with this, but ideally, whenever possible, it should also convert to a number without the need to convert to a string first.
