Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC year formatted as 'YYYY' abnormally #2722

Open
Jevin0 opened this issue Sep 9, 2024 · 0 comments
Open

BC year formatted as 'YYYY' abnormally #2722

Jevin0 opened this issue Sep 9, 2024 · 0 comments

Comments

@Jevin0
Copy link

Jevin0 commented Sep 9, 2024

Describe the bug
If you use 'dayjs('-000001').year()', you can get the real '-1' year. But if you use the format method, the internal padStart will automatically fill in 0. I'm not sure if this is a special scenario? Does it need special processing?

dayjs('-000001').format('YYYY') 
//  '00-1'

dayjs('-000010').format('YYYY') 
//  '0-10'

dayjs('-000100').format('YYYY')
// '-100'

Expected behavior

dayjs('-000001').format('YYYY') 
// '-0001'

dayjs('-000010').format('YYYY') 
//  '-0010'

dayjs('-000100').format('YYYY')
// '-0100'

Information

  • Day.js Version [e.g. v1.11.13]
  • OS: [e.g. windows]
  • Browser [e.g. chrome 128]
  • Time zone: utc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant