Nov 03, 2010, 8:37 PM
[CLOSED] Different time zone settings on DateFields
I have two date fields and I?m trying to get the difference between the dates (in days). When I enter start date before November 7, 2010 and end date after it I get a number that is not an integer.
It appears that dates are using different time zone settings: start date is in "Central Daylight Time" and end date is in "Central Standard Time", so I get an extra hour that messes up my calculation. You can see that both date fields are declared in the same manner so I would expect them to use the same time zone settings.
This looks like a bug. Can this be fixed? Is there a property in ext:DateField that disregards or specifies time zone?
Here is my code:
George
It appears that dates are using different time zone settings: start date is in "Central Daylight Time" and end date is in "Central Standard Time", so I get an extra hour that messes up my calculation. You can see that both date fields are declared in the same manner so I would expect them to use the same time zone settings.
This looks like a bug. Can this be fixed? Is there a property in ext:DateField that disregards or specifies time zone?
Here is my code:
<script type="text/javascript">
//get date difference in days
function getDateDiff() {
var start_date = Ext.getCmp('dtStart').getValue();
var end_date = Ext.getCmp('dtEnd').getValue();
alert((end_date - start_date) / (1000 * 60 * 60 * 24) + ' - start date offset: ' + start_date.getGMTOffset() + ', end date offset: ' + end_date.getGMTOffset());
}
</script>
<ext:DateField ID="dtStart" runat="server"></ext:DateField>
<ext:DateField ID="dtEnd" runat="server"></ext:DateField>
<ext:Button runat="server" Text="Get Difference">
<Listeners>
<Click Handler="getDateDiff()" />
</Listeners>
</ext:Button>
Thanks,George
Last edited by Daniil; Nov 04, 2010 at 10:36 PM.
Reason: Please use [CODE] tags, [CLOSED]