I have an issue with the spark DateTimeFormatter:

I need to check that a date is properly formatted using the currently set 
locale settings.

This works very nicely for a US locale:
var str:String = "12/13/2015";
formatter.format(str) == str;

However, for European locales, this does not work because the format method 
blindly converts the string to a date using:
new Date(value);
The Date constructor assumes the month is before the day which is not true for 
those locales.
The mx DateFormatter class has a parseDateString function which converts the 
date string into a Date object using the current locale settings. The problem 
with DateFormatter is that the format spec is very different than the Spark one.

Is there something I’m missing, or is DateTimeFormatter missing some essential 
functionality?

Harbs

Reply via email to