Ticket #640 (closed defect: fixed)

Opened 3 years ago

Last modified 18 months ago

dojo.date.fromSql (wrong month due to improper use of parseInt) - Bug in changeset 3595

Reported by: joey@… Owned by: ttrenka
Priority: normal Milestone:
Component: General Version: 0.3
Severity: normal Keywords:
Cc:

Description

Hi,

Changeset 3595 was submitted to fix ticket #519, an excerpt from the code:

return new Date(parts[0], (parseInt(parts[1])-1), parts[2], parts[3], parts[4], parts[5]);

A better fix would be:

return new Date(parts[0], (parseInt(parts[1], 10)-1), parts[2], parts[3], parts[4], parts[5]);

This is because months after a date such as 2006-08-01 will get parsed incorrectly as a leading zero in front of a parseInt'ed string will result in it being parsed as a base 8 numeral instead of a base 10 one.

Thank you and have a nice day.

Change History

Changed 3 years ago by ttrenka

  • status changed from new to closed
  • resolution set to fixed

Committed as changeset #3657.

Changed 18 months ago by anonymous

  • milestone deleted

Milestone 0.3release deleted

Note: See TracTickets for help on using tickets.