tracker issue : CF-4103427

select a category, or use search below
(searches all categories and all time range)
Title:

[ANeff] ER for: dateFormat() and dateTimeFormat() "Y" mask

| View in Tracker

Status/Resolution/Reason: To Fix//

Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)

Created: 01/04/2016

Components: Language

Versions: 11.0

Failure Type: Enhancement Request

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Trivial / Unknown

Locale/System: English / Win All

Vote Count: 1

The dateTimeFormat() doc links to the SimpleDateFormat doc for the complete list of masks. SimpleDateFormat supports the "Y" (ISO week year) mask as of Java 7.

Issue: dateFormat() and dateTimeFormat() don't support the "Y" mask.

Example:

<cfscript>
  dateTime = createDate(2016,1,3);
  
  locale = createObject("java", "java.util.Locale").init("en", "GB");
  sdf = createObject("java", "java.text.SimpleDateFormat").init("Y", locale);
  writeOutput(sdf.format(dateTime));//returns 2015 (good)
  
  setLocale("en_GB");
  writeOutput(dateTimeFormat(dateTime, "Y"));//returns 2016 (bad)
</cfscript>

Actual output: 20152016

Expected output: 20152015

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4103427

External Customer Info:
External Company:  
External Customer Name: Aaron Neff
External Customer Email:

Attachments:

Comments:

Hi Adobe, I see this ticket is Open/ToTest/Contested. Why contested? Is it b/c the single "y" and single "Y" masks currently return the 4-digit year? Well, only 2-character "yy" and 4-character "yyyy" are documented for dateFormat() and dateTimeFormat(). So there is no need to maintain backward-compat for single "y" and single "Y" since those are undocumented. Thanks!, -Aaron
Comment by External U.
4967 | January 09, 2016 02:11:32 AM GMT
Just noting I had JVM arg -Duser.timezone=GMT when running the repro in the description.
Comment by External U.
4968 | January 11, 2016 09:29:48 PM GMT
I was wondering if the "X" mask works in ColdFusion 11, because it is also mentioned in the documentation and not working in ColdFusion 10.
Comment by External U.
4969 | April 13, 2016 02:53:33 AM GMT
Documented features should correspond with actual features.
Vote by External U.
4970 | April 13, 2016 02:53:48 AM GMT