Skip to content

Wrong week number on Dec 30 and 31 #6719

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

Closed
gchokeen opened this issue Dec 23, 2024 · 2 comments
Closed

Wrong week number on Dec 30 and 31 #6719

gchokeen opened this issue Dec 23, 2024 · 2 comments

Comments

@gchokeen
Copy link

Bug description

The week number for December 30th and 31st is incorrectly shown as Week 1 in the calendar when using the bsDatepicker component of ngx-bootstrap (version 10.0.0) with Angular ^15.2.10. According to the ISO-8601 standard (used in en-GB locale), these dates should be part of the last week of the year (Week 52).

This issue is reproducible in your official examples on the documentation site as well:
https://valor-software.com/ngx-bootstrap/#/components/datepicker?tab=examples.


Plunker/StackBlitz that reproduces the issue

https://valor-software.com/ngx-bootstrap/#/components/datepicker?tab=examples](https://valor-software.com/ngx-bootstrap/#/components/datepicker?tab=examples

Steps to reproduce:

  1. Use the bsDatepicker component with the configuration for the en-GB locale.
  2. Open the date picker and navigate to the calendar for December 2024.
  3. Observe the week numbers for December 30th and 31st.

Versions of ngx-bootstrap, Angular, and Bootstrap

  • ngx-bootstrap: 10.0.0
  • Angular: ^15.2.10
  • Bootstrap: Default Bootstrap version included with ngx-bootstrap.

Build system

  • Build tool: Angular CLI

Expected behavior

The week number for December 30th and 31st, 2024, should be displayed as Week 52 in accordance with the ISO-8601 standard, given that en-GB is used for the LOCALE_ID.


Additional context

  • Configurations in providers:
    {
        provide: LOCALE_ID,
        useValue: "en-GB"
    },
    {
        provide: DATE_PIPE_DEFAULT_OPTIONS,
        useValue: { timezone: 'Europe/London' }
    }
@Paraiso83
Copy link

Paraiso83 commented Dec 23, 2024

@gchokeen Actually, according to the ISO, it is correct, the first week of the Year would be the one that ha the first Thursday, that for 2024/2025 will be in 2025.

This means that for this year, the 30th, and 31st belong to the first week of 2025.
Also, as the 52nd week is the one from the 23rd to 29th, if we would actually have the 30th and 31st belong to a week of 2024, it would be the 53rd week, just like in 2021, and for that one, the calendar is wrong, as it shows that the week of December 27th to January 2nd was the week 1, but in that case it would actually have been the 53rd week.

You can see the rules on wikipedia: https://en.wikipedia.org/wiki/ISO_8601

And also it not being followed for the year 2022:
image

But for 2024/2025, it is correct

@gchokeen
Copy link
Author

@Paraiso83 Thanks for the clarification!

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

2 participants