You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flex.apache.org by "William Page (JIRA)" <ji...@apache.org> on 2013/08/09 07:41:50 UTC
[jira] [Comment Edited] (FLEX-33658) Using the mx:DateFormatter in
Actionscript no longer produces the same results
[ https://issues.apache.org/jira/browse/FLEX-33658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13734416#comment-13734416 ]
William Page edited comment on FLEX-33658 at 8/9/13 5:40 AM:
-------------------------------------------------------------
Thanks for the quick response...
I thought that the issue was because of international dates, and therfore thought it could be related to locales...
I will use your refactored function as its it much cleaner than mine (below to illustrate the issue further)...
I was short on time and had a similar function in various controllers so I came up with this (not a great solution but worked without having to change any database queries)
private function MonthDisplay(item:String):String{
var df:DateFormatter = new DateFormatter();
var first:String = item.substr(0,2);
var second:String = item.substr(3,2);
var third:String = item.substr(7,4);
item = second+'/'+first+'/'+third;
df.formatString="MMM-YYYY";
return df.format(item);
}
FYI
Also the dateFormatter now fails when reading in along date such as ... and then formatting with this formatString="EEEE, MMM. D, YYYY at L:NN A"
In this case I was just attempting to remove the miliseconds from a datetime string...It worked previously...since this was only in one place in my application I redid the php script query like this to solve the issue by elimiating the formatString altogether
SELECT convert(varchar, LastImportDate, 107)+SUBSTRING(CONVERT(varchar, LastImportDate,0),12,8) as thisDate
from tblstores order by storeid
Hopefully these examples help any future issue encountered by other developers...Also great job on the release I am noticing faster load times on my more complex modules...
was (Author: wpageiii):
Thanks for the quick response...
I thought that the issue was because of international dates, and therfore thought it could be related to locales...
I will use your refactored function as its it much cleaner than mine...
I was short on time and had a similar function in various controllers so I can up with this (not a great solution but worked without having to change any database queries)
private function MonthDisplay(item:String):String{
var df:DateFormatter = new DateFormatter();
var first:String = item.substr(0,2);
var second:String = item.substr(3,2);
var third:String = item.substr(7,4);
item = second+'/'+first+'/'+third;
df.formatString="MMM-YYYY";
return df.format(item);
}
FYI
Also the dateFormatter now fails when reading in along date such as ... and then formatting with this formatString="EEEE, MMM. D, YYYY at L:NN A"
In this case I was just attempting to remove the miliseconds from a datetime string...It worked previously...since this was only in one place in my application I redid the php script query like this to solve the issue by elimiating the formatString altogether
SELECT convert(varchar, LastImportDate, 107)+SUBSTRING(CONVERT(varchar, LastImportDate,0),12,8) as thisDate
from tblstores order by storeid
Hopefully these examples help any future issue encountered by other developers...Also great job on the release I am noticing faster load times on my more complex modules...
> Using the mx:DateFormatter in Actionscript no longer produces the same results
> ------------------------------------------------------------------------------
>
> Key: FLEX-33658
> URL: https://issues.apache.org/jira/browse/FLEX-33658
> Project: Apache Flex
> Issue Type: Bug
> Components: Advanced Data Grid
> Affects Versions: Apache Flex 4.10.0
> Reporter: William Page
>
> Here is the code…
> var j:int = 0;
> for (i=minNum;i<length;i++) {
> oColumnDef = new AdvancedDataGridColumn();
> oColumnDef.headerText = MonthDisplay(modelLocator.aryMonths.getItemAt(i).begDate);
> oColumnDef.dataField = "s"+[j+1];
> oColumnDef.width = 100;
> oColumnDef.labelFunction=dgCurFormat12
> oColumnDef.setStyle("textAlign","right")
> colArray.push(oColumnDef);
> j=j+1;
> }
> private function MonthDisplay(item:String):String{
> var df:DateFormatter = new DateFormatter()
> df.formatString="MMM-YYYY";
> return df.format(item);
> }
> aryMonths contains dates like these ('07/01/2013', '06/01/2013', '05/01/2013', '04/01/2013', '03/01/2013', etc)
> The header text ends up showing Jan-2013, Jan-2013, Jan-2013, Jan-2013, Jan-2013 etc)
> It seems that the DateFormatter is reading the date in reverse order Day-Month-Year when applying the format…Versus Month-Day-Year…Is there a way to resolve this without rewriting all my database scripts to reformat dates?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira