-
Notifications
You must be signed in to change notification settings - Fork 769
Open
Description
Describe the bug
I cannot use the token 'x' and 'X' to convert a unix epoch time in (milli)seconds to a datetime using the .fromFormat() method.
To Reproduce
luxon.DateTime.fromFormat('1769758221', 'X')
Actual vs Expected behavior
fromFormat() method gives a unparseable error with explanation the input "1769758221" can't be parsed as format X .
I expect the result to be datetime object which when converted toISO() is 2026-01-30T08:30:21.000+01:00
Desktop:
- OS: Windows 11
- Browser Chrome 144.0.7559.97
- Luxon version 3.7.2
- Europe/Amsterdam
Additional context
I may be misunderstanding if fromFormat() method can convert from unix epoch timestamps at all. It is not clear from the documentation. There is a macro token 'x' and 'X' but it seems to work for the toFormat() method instead.
Reactions are currently unavailable