Skip to main content

Search and Top Navigation

#8420 closed bug (wontfix)

Opened July 02, 2012 09:16PM UTC

Closed December 05, 2012 04:08PM UTC

Last modified December 19, 2012 06:36PM UTC

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.

Attachments (0)
Change History (10)

Changed July 02, 2012 10:44PM UTC by brotherli comment:1

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.

Changed July 03, 2012 12:51AM UTC by scottgonzalez comment:2

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

Changed July 09, 2012 02:38PM UTC by alex.ghiculescu comment:3

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).

Changed October 11, 2012 02:45PM UTC by scottgonzalez comment:4

milestone: 1.9.01.11.0

Changed October 19, 2012 08:25PM UTC by mikesherov comment:5

keywords: → haspatch
status: newopen

Changed December 05, 2012 04:08PM UTC by scottgonzalez comment:6

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.

Changed December 06, 2012 08:13AM UTC by brotherli comment:7

Replying to [comment:6 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.

Changed December 06, 2012 08:15AM UTC by brotherli comment:8

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

Changed December 19, 2012 04:48PM UTC by tj.vantoll comment:9

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

Changed December 19, 2012 06:36PM UTC by scottgonzalez comment:10

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.