Moment-timezone: Moment Timezone has no data for PST

Created on 16 Sep 2015  路  6Comments  路  Source: moment/moment-timezone

I'm getting: Moment Timezone has no data for PST. See http://momentjs.com/timezone/docs/#/data-loading/. when running the following code in Node.JS:

var departure = moment.tz('2015-09-16 16:05', 'YYYY-MM-DD HH:mm', 'PST');

However this code seems to work:

var arrival = moment.tz('2015-09-16 17:05', 'YYYY-MM-DD HH:mm', 'EST');

So it appears that it doesn't like the PST timezone. (Also tried with PDT and EDT and it wouldn't work with either)

Most helpful comment

We rely on the tzdb for source data.

  • EST exists as a zone entry for backwards compatibility reasons in the tzdb, but it is fixed to EST and does not switch to EDT for daylight saving time.
  • PST does not exist as a zone entry in the tzdb.
  • In general, abbreviations do not make good identifiers. There are too many ambiguities, such as CST having 5 different meanings.
  • If you want a time zone that switches properly between standard and daylight times, use a location-based identifier. For Pacific time, use "America/Los_Angeles". For Eastern time, use "America/New_York"
  • If you actually want a fixed offset zone, then just use the utcOffset function in moment. You don't need moment-timezone.

All 6 comments

We rely on the tzdb for source data.

  • EST exists as a zone entry for backwards compatibility reasons in the tzdb, but it is fixed to EST and does not switch to EDT for daylight saving time.
  • PST does not exist as a zone entry in the tzdb.
  • In general, abbreviations do not make good identifiers. There are too many ambiguities, such as CST having 5 different meanings.
  • If you want a time zone that switches properly between standard and daylight times, use a location-based identifier. For Pacific time, use "America/Los_Angeles". For Eastern time, use "America/New_York"
  • If you actually want a fixed offset zone, then just use the utcOffset function in moment. You don't need moment-timezone.

I'm facing some issue in time xone

var dec = moment("2016-12-01T12:00:00Z");
dec.tz('America/Los_Angeles').format('ha z'); // 4am PST
Result : "5am PDT"

But it should return in PST format ...

I suspect , the issue is in data loading

moment.tz.add('America/Los_Angeles|PST PDT|80 70|0101|1Lzm0 1zb0 Op0');

If i switch the location of PST and PDT always returns PST not in PDT .

@satkamar - This doesn't belong on this thread. Commenting on old, closed, unrelated issues is a sure way to get ignored. I'll be happy to answer your question if you create a new issue. Thanks.

Is moment timezone reflects for PST and PDT?

@webmaster1990 The timezone is not there by default, adding explicitely. So you have to load the data

like,

moment.tz.add("America/Los_Angeles|PST PDT|80 70|01010101010101010101010|1BQW0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|15e6");

Just use the moment-timezone "with data" files available on the home page or through your favorite CDN.

Was this page helpful?
0 / 5 - 0 ratings