date-time-format-timezone icon indicating copy to clipboard operation
date-time-format-timezone copied to clipboard

timeZoneName value is empty in PhantomJS

Open urfijus opened this issue 7 years ago • 1 comments

I am using Intl.js + date-time-format-timezone polyfills.

I expect to see timeZoneName value in formatToPart() output.

Run

 const formatter2 = new Intl.DateTimeFormat('en, {
                timeZone: 'Asia/Calcutta',
                timeZoneName: 'long',
                year: 'numeric',
                month: 'numeric',
                day: 'numeric',
                hour: 'numeric',
                minute: 'numeric',
 }).formatToParts(new Date());

Output: PhantomJS 2.1.1 (Mac OS X 0.0.0): [Object{type: 'month', value: '2'}, Object{type: 'literal', value: '/'}, Object{type: 'day', value: '28'}, Object{type: 'literal', value: '/'}, Object{type: 'year', value: '2018'}, Object{type: 'literal', value: ', '}, Object{type: 'hour', value: '7'}, Object{type: 'literal', value: ':'}, Object{type: 'minute', value: '25'}, Object{type: 'literal', value: ' '}, Object{type: 'dayPeriod', value: 'PM'}, Object{type: 'literal', value: ' '}, Object{type: 'timeZoneName', value: ''}]

As you can see timeZoneName value is empty.

With format() call output is: '3/1/2018, 12:58 AM India Standard Time'

urfijus avatar Feb 28 '18 19:02 urfijus

I have't tested myself, did you add all necessary locale data ?? https://codepen.io/markandey/full/vvJejz try here

markandey avatar Dec 27 '18 10:12 markandey