Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#8420 closed bug (wontfix)

Datepicker: calculateWeek doesn't take firstDay setting into account

Reported by: brotherli Owned by:
Priority: minor Milestone: 1.11.0
Component: ui.datepicker Version: 1.8.21
Keywords: haspatch Cc:
Blocked by: Blocking:

Description

When the first day of the week is set to anything but Monday, the week numbers on the left are inevitably wrong because the week will contain days from two different calendar weeks, while only one is being displayed.

E.g. Week 31 2012 is defined as Monday 30.7. to Sunday 5.8. but computed as Week 30 when the first day of the week is set to Sunday because that first Sunday is still from week 30.

Correct would be 30/31 for week number in such situations.

Change History (10)

comment:1 Changed 11 years ago by brotherli

Correction for the summary of this ticket: "calculateWeek doesn't take firstDay setting into account" Actually the behavior of iso8601Week() is correct but the date passed to the calculateWeek callback function should be adjusted according to firstDay.

comment:2 Changed 11 years ago by Scott González

Summary: iso8601Week() doesn't take firstDay setting into accountDatepicker: calculateWeek doesn't take firstDay setting into account

comment:3 Changed 11 years ago by alex.ghiculescu

https://github.com/jquery/jquery-ui/pull/693

The datepicker will now look like http://i.imgur.com/Y1xGR.png when firstDay is to 0 (Sunday).

comment:4 Changed 10 years ago by Scott González

Milestone: 1.9.01.11.0

comment:5 Changed 10 years ago by mikesherov

Keywords: haspatch added
Status: newopen

comment:6 Changed 10 years ago by Scott González

Resolution: wontfix
Status: openclosed

I'm going to close this because I'm not sure this is correct behavior. If you can provide examples of other calendars that do this, please leave a comment so we can reconsider. Thanks.

comment:7 in reply to:  6 Changed 10 years ago by brotherli

Replying to scott.gonzalez:

I'm going to close this because I'm not sure this is correct behavior. If you can provide examples of other calendars that do this, please leave a comment so we can reconsider. Thanks.

As per definition in ISO 8601, calendar weeks start with Monday. There's not much more to say than already described in the ticket description. If the calendar widget doesn't start with Monday, one line represents more than one calendar week and that should be visualized somehow. I rekon that most of the calendar software doesn't respect this fact but some do. I'll attach a screen shot from Kontact for KDE.

comment:8 Changed 10 years ago by brotherli

Screenshot from KOrganizer calendar widget with weeks starting on Sunday: http://i.imgur.com/ppW3b.png

comment:9 Changed 10 years ago by tj.vantoll

Just because I don't see it listed anywhere you can see the current behavior here - http://jsfiddle.net/tj_vantoll/YcMXQ/.

comment:10 Changed 10 years ago by Scott González

brotherli: Thanks for providing that screenshot. After discussing this with the team, we feel that this is uncommon enough that we'd like to keep the current implementation. However, if someone wants to send a pull request that pulls the showWeek logic out into a separate function so that you can override it to show both weeks, we'd accept that.

Note: See TracTickets for help on using tickets.