Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#6960 closed defect (fixed)

Day of Year returns different value on same day

Reported by: jerjoham@… Owned by: Adam Peller
Priority: high Milestone: 1.2
Component: Date Version: 1.1.1
Keywords: day of year Cc: mde@…, Bryan Forbes
Blocked By: Blocking:

Description

call to dojo.date.locale._getDayOfYear(new Date()) returns different value before 1pm EDT due to rounding. This could be resolved by returning Math.ceil(delta) from dojo.date.difference(). see attached

Attachments (1)

day of year.png (20.4 KB) - added by guest 11 years ago.

Download all attachments as: .zip

Change History (5)

Changed 11 years ago by guest

Attachment: day of year.png added

comment:1 Changed 11 years ago by bill

Cc: jerjoham@… removed
Component: GeneralDate
Owner: changed from anonymous to Adam Peller
Reporter: changed from guest to jerjoham@…

comment:2 Changed 11 years ago by Adam Peller

Cc: mde@… Bryan Forbes added
Milestone: 1.2

Math.floor, I think? Hrm. Why round instead of floor? And what might we break with this change?

comment:3 Changed 11 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [14132]) Avoid rounding issue in dojo.date.difference by comparing Date objects with the same hour. Fixes #6960

comment:4 Changed 11 years ago by Adam Peller

Matthew reminded me that sometimes it's perfectly reasonable to round (2 hours 59 minutes might as well be 3 hours) We could have used round or parseInt (truncate, to accomodate negative numbers) but at least we documented our choice properly.

Note: See TracTickets for help on using tickets.