Open Bug 1356242 Opened 3 years ago Updated 3 years ago

Investigate if dateFormat.js is still needed


(MailNews Core :: Internationalization, enhancement)

Not set


(Not tracked)


(Reporter: aryx, Unassigned)



Aceman in bug 1346549 comment 9:

::: mailnews/base/content/dateFormat.js
@@ +24,5 @@
>    try {
> +    const dateFormatter = new Intl.DateTimeFormat(undefined,
> +      { year: '2-digit', month: 'numeric', day: 'numeric' });
> +    var aDate = new Date(1999, 11, 1);
> +    var dateString = dateFormatter.format(aDate);

This doesn't need Intl.
The change probably does not make things worse, but ask myself whether the whole dateFormat.js is needed today. It analyses how the locale formats dates and then produces similar date strings when we ask it ( via convertDateToString), mimicking the locale format.
I see we may need to convert the string back to a JS date/time milliseconds (convertStringToPRTime). But I would like to see a bug about analysing if this is still needed. Maybe we could just store the seconds value at the callers and format them properly via Intl. not via convertDateToString.
You need to log in before you can comment on or make changes to this bug.