Skip to content
This repository has been archived by the owner on Jun 27, 2020. It is now read-only.

timeZoneName value is empty in PhantomJS #19

Open
urfijus opened this issue Feb 28, 2018 · 1 comment
Open

timeZoneName value is empty in PhantomJS #19

urfijus opened this issue Feb 28, 2018 · 1 comment

Comments

@urfijus
Copy link

urfijus commented Feb 28, 2018

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'

@markandey
Copy link
Collaborator

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants