Comment 10 for bug 1594937

Revision history for this message
Dan Scott (denials) wrote :

Yeah; the following seems to work reasonably well right now:

function cdDateToDate(date) {
    var date_obj = new Date(Date.parse(date));
    return date_obj.toLocaleDateString();
}

That displays closed dates like:

    Every Day From 20/08/2016 through 21/08/2016
and
    All Day 20/02/2017

... so we lose the sane YYYY-mm-dd display, but we get actual date comparisons.

Passing a different locale as the first argument to toLocateDateString() doesn't seem to change the results in the staff client.

Of course, toLocaleDateString() only got support for the locales and options arguments in Firefox 29, and I completely forgot about XUL being hella-old, heh :) But I think toLocaleDateString() and friends is a good way forward for the web staff client, and perhaps we can live with this minor regression in localized date formatting in the XUL staff client until such time as we get away from it entirely?