PDA

View Full Version : [OPEN] Ext.Date.add(date, Ext.DAY, daysToAdd) ignores daylight savings



natb
12 Nov 2012, 9:36 AM
REQUIRED INFORMATION
Ext version tested:

Sencha Touch 2.1 final release
Browser versions tested against:

Safari 5.1. desktop
Description:

Ext.Date.add(date, Ext.Date.DAY, 1) adds fixed [milliseconds in day] to the given date value.
This logic may not work if date is a day when daylight savings are applied.
Steps to reproduce the problem:

Configure Eastern Time (US & Canada) time zone on your machine.
Run the test case -> date2 object points to Nov,4 but expected to be Nov, 5.
Test Case:

var date1 = new Date(2012, 10, 4) // the day when daylight saving were applied this year
date1 // Sun Nov 04 2012 00:00:00 GMT-0400 (Eastern Daylight Time)

var date2 = Ext.Date.add(date1, Ext.Date.DAY, 1)
date2 // Sun Nov 04 2012 23:00:00 GMT-0500 (Eastern Standard Time)


To workaround:


var date1 = new Date(2012, 10, 4) //2012 Nov, 4 - the day when daylight saving were applied this year
date1 // Sun Nov 04 2012 00:00:00 GMT-0400 (Eastern Daylight Time)

var date2 = new Date (date1.getYear(), date1.getMonth(), date1.getDate() + 1)
date2 // Sat Nov 05 112 00:00:00 GMT-0400 (Eastern Daylight Time)

mitchellsimoens
12 Nov 2012, 2:54 PM
Thanks for the report! I have opened a bug in our bug tracker.