Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation includes function filterYears but most recent version does not #319

Closed
dodtsair opened this issue Mar 24, 2016 · 2 comments
Closed

Comments

@dodtsair
Copy link

Am I missing something?

I do the following:

var momentTZ = require('moment-timezone');



var currentDate = new Date();
var currentYear = currentDate.getFullYear();
var zoneNames = momentTZ.tz.names();
var unpackedZones = [];
zoneNames.forEach(function(zoneName) {
  unpackedZones.push(momentTZ.tz.zone(zoneName));
});
var relevantZones = momentTZ.tz.filterYears(unpackedZones, currentYear);

This errors calling momentTZ.tz.filterYears because it does not exist. Was this function removed?

How do I get a list of zones and relevant information to the present?

@timrwood
Copy link
Member

As noted at the top of the section in http://momentjs.com/timezone/docs/#/data-utilities/, these utilities are available in moment-timezone-utils.js. I think you should be able to load them for use by changing the first lines to something like this.

var momentTZ = require('moment-timezone');
require('moment-timezone/moment-timezone-utils');

These will be moved around a bit with the conversion to es6 modules in #310. What are you trying to accomplish when using filterYears, is there a way we could make this easier to use for you?

@dodtsair
Copy link
Author

I was trying to get a list of TZ names that are current. I didn't want a list that includes TZs that never existed or were no longer used.

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

No branches or pull requests

3 participants