HomeGenie Forum

Development => Bug reporting => Topic started by: bradvoy on November 22, 2014, 10:11:56 PM

Title: Date formatting
Post by: bradvoy on November 22, 2014, 10:11:56 PM
I am in the US where we expect to see dates in mm/dd/yy format.  The doorwindow widget displays the update time in dd/mm/yy format.  It looks like this is due to the following line in HG.WebApp.Utility.FormatDate (homegenie.webapp.js):

Code: [Select]
var dt = $.datepicker.formatDate('D, dd/mm/yy', date);
If I change this line to

Code: [Select]
var dt = date.toLocaleDateString();
then the date is displayed in the expected format.  Is this a change that could/should be incorporated into the code base?
Title: Re: Date formatting
Post by: Gene on November 22, 2014, 11:44:33 PM
Can you try with attacched file and tell if it's working?

Thanks,
g.
Title: Re: Date formatting
Post by: bradvoy on November 23, 2014, 09:37:01 PM
Gene, this code does not fix the problem because HG.WebApp.Locales.GetDateEndianType() doesn't handle negative timezone offsets from UTC correctly.  I am in the Mountain Standard timezone, which has an offset of -7 hours from UTC.  After the line

Code: [Select]
var testDate = new Date(98326800000);
testDate evaluates to 18:00 on 11 February 1973 in my timezone.  So localeDateParts[1] gets set to "11" and the function always returns 'L'.  It should return 'M' for my locale.
Title: Re: Date formatting
Post by: Gene on November 23, 2014, 09:46:22 PM
well let's test against the month part then =D

g.
Title: Re: Date formatting
Post by: bradvoy on November 24, 2014, 01:50:41 AM
This one works great.  Thanks for the quick fix.