Intl.DateTimeFormat doesn’t currently let you specify a custom pattern in ICU/CLDR format. The reason is that the API had to be implemented on top of different existing internationalization APIs, and the API on Windows didn’t support CLDR date format patterns.
There is a feature request for patterns and skeletons in DateTimeFormat – I don’t know if the current Internationalization ad-hoc is planning to take it up: https://bugs.ecmascript.org/show_bug.cgi?id=771 You can get an ISO 8601-style date format directly from Date.prototype.toISOString, but that uses the Gregorian calendar and UTC; it cannot be configured to use the Persian calendar or Iran time. Norbert > On Aug 16, 2015, at 10:45 , Muhammad Hussein Fattahizadeh > <[email protected]> wrote: > > I want to use Intl.DateTimeFormat but with custom pattern for output. I use > this method for php version of ICU dateformat and it's work well. > $fmt = datefmt_create( > > > 'fa_IR@calendar=persian', > > > IntlDateFormatter::FULL, > > > IntlDateFormatter::FULL, > > > 'Asia/Tehran', > > > IntlDateFormatter::TRADITIONAL, > > > 'EEEE d MMMM yyyy HH:mm' // as ISO_8601 > ); > > > echo datefmt_format > ($fmt, time()) . "\n"; > // پنجشنبه ۱۰ اردیبهشت ۱۳۹۴ ۱۲:۱۲ > How can i set pattern as ICU documentation in Intl.DateTimeFormat like php > version of Intl/ICU date time formatter. > > My javascript code > > console.log(new Intl.DateTimeFormat('fa-IR-u-ca-persian').format(new > Date())); // ۱۳۹۴/۵/۲۵ ه.ش. > How can iset ISO_8601 pattern in my javascript format pattern like EEEE d > MMMM yyyy HH:mm or MM yy dd or etc ? > > ISO_8601 > > PHP IntlDateFormatter::format > > ICU Date formatter > > ICU Date formats > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

