Formatter timestamp seconds now working
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Using the plugin advancedFormat for converting seconds timestamp to string is not working.
If i say:
dayjs(1700513213, 'X').format('YYYY/MM/DD HH:mm:ss'), the result in not correct, it says 1970/bla/bla...
while using milliseconds timestamp it is working:
dayjs(1700513213000, 'x').format('YYYY/MM/DD HH:mm:ss'), the result in correct, it says 2023/bla/bla...
Expected behavior
dayjs(1700513213, 'X').format('YYYY/MM/DD HH:mm:ss') says 2023/bla/bla/...
I remember in older versions it works.
Information
- Day.js Version: 1.11.10
- OS: windows 10
- Browser: chrome 119.0.6045.160
- Time zone: Italy
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the advancedFormat plugin using the documented X and x timestamp examples. Start by tracing how the plugin parses the X token, then compare the seconds and milliseconds cases and add a regression test; done means the seconds example formats to the expected 2023 date without breaking the milliseconds case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100