On 7/27/15, 1:49 AM, "Harbs" <[email protected]> wrote:

>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?

Well, yes, it is a formatter not a parser.  Looks like Flash doesn’t want
to take on the tokenizing task so you’ll have to build your own.  I think
you can get the locale format from
flash.globalization.DateFormatter.getDateTimePattern()

BTW, will you have time to look at the TLF performance issue soon?

-Alex

Reply via email to