Skip navigation
Currently Being Moderated

Problem with DateTimeFormatter and LocaleID.DEFAULT

Oct 4, 2011 4:39 AM

I have developed an application that runs on iOS, QNX and Android, that receives remote data via web services. Some of the data are Date, Time or DateTime.

 

I created a global class containing the formatters used to display the respective DateTime fields in the user's local date time format:

 

public var frmtDateOnly:spark.formatters.DateTimeFormatter;
public var frmtTimeOnly:spark.formatters.DateTimeFormatter;
public var frmtDateTime:spark.formatters.DateTimeFormatter;

 

public function ViewStackGlobals():void
{

 




this.OS = Capabilities.os.substr(0,3);



this.locale = LocaleID.DEFAULT;
this.frmtDateOnly = new spark.formatters.DateTimeFormatter();
this.frmtDateOnly.setStyle("locale",this.locale);
this.frmtDateOnly.timeStyle = DateTimeStyle.NONE;
this.frmtDateOnly.dateStyle = DateTimeStyle.SHORT;
this.frmtTimeOnly = new spark.formatters.DateTimeFormatter()
this.frmtTimeOnly.setStyle("locale",this.locale);
this.frmtTimeOnly.timeStyle = DateTimeStyle.SHORT;
this.frmtTimeOnly.dateStyle = DateTimeStyle.NONE;
this.frmtDateTime = new spark.formatters.DateTimeFormatter()
this.frmtDateTime.setStyle("locale",this.locale);
this.frmtDateTime.timeStyle = DateTimeStyle.SHORT;
this.frmtDateTime.dateStyle = DateTimeStyle.SHORT;
}

 

Whilst on QNX the formatters have correct settings, and when using the format() method I get correct results, on Android it doesn't work (well on my HTC Desire HD that is).

 

The table below shows the debugger output. Whilst the actualLocaleIDName is correctly set to en-GB, the dateTimePattern is still the en-US format. As said before, the same does work for QNX, I have not tested this yet with iOS.

 

frmtDateOnlyspark.formatters.DateTimeFormatter (@48396c81)
[inherited]
actualLocaleIDName"en-GB"
dateStyle"short"
dateStyleOverride"short"
dateTimePattern"M/d/yy"
dateTimePatternOverridenull
errorTextnull
_errorTextnull
fallbackFormatternull
g11nWorkingInstanceflash.globalization.DateTimeFormatter (@48163c29)
_g11nWorkingInstanceflash.globalization.DateTimeFormatter (@48163c29)
lastOperationStatus"noError"
resourceManagermx.resources.ResourceManagerImpl (@463f83c1)
timeStyle"none"
timeStyleOverride"none"
useFallbackfalse

 

Maybe I'm doing something wrong. I assume - hopefully correctly - that their must be a way to use (receive) the user / device settings for date time formatting and that one doesn't require to have a configuration document per application that a user would need to set to likings.

 
Replies
  • Currently Being Moderated
    Oct 5, 2011 11:12 AM   in reply to fdn64

    Thank you for reporting the issue. Our team is looking into this and we will get back to you.

     

    Thank you for your patience,

    Dipti

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 6, 2011 2:21 PM   in reply to fdn64

    Hi,

    I checked it in FB4.5 simulator for Android HTC Desire HD (Windows) and on mac FB4.5 simulator (HTC Incredible). For frmtdateOnly, I do see the correct patterm of dd/MM/yyyy (windows simulator, HTC Desire HD), Mac (HTC Incredible) on both. The actualLocaleID is correct;y shown as en-GB.

    I did set the locale as en-GB in control panel regional language settings (win) and mac system language settings.

     

    I need to check it on the actual device and see the problem. I will get back to you on this.

     

    Thanks,

    harish

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 20, 2011 12:03 PM   in reply to fdn64

    I verified it on Google Nexus. Handling i-default does have a bug on android devices.Possible work around is if you can use the locale explicitly en-GB  then the  bug won't surface. We filed a bug against it for near future fix.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 4, 2012 7:28 AM   in reply to harishs@adobe

    harish@adobe - has this been fixed? What was the bug #?

     

    I'm still encountering this using Flex 4.6 and Air 3.2.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points