dmfilipenko / timezones.json

Full list of timezones
MIT License
796 stars 664 forks source link

flatten and dedupe "utc" timezones #4

Closed atis-- closed 8 years ago

atis-- commented 8 years ago

This was a nice addition, but why so many duplicated timezones? And some are multiple zones concatenated together in a single string? This pull request removes the dupes, splits the clumps, and sorts 'em alphabetically. This is what I ran it through:

const _ = require('lodash');
require('./timezones.json').map(z => {
    if (!z.utc)
        return z;
    z.utc = _(z.utc)
        .reduce((splits, utc) => {
            // split strings
            return splits.concat(utc.split(/\s+/))
        }, _([]))
        .uniq()
        .sort()
        .value();
    return z;
});
dmfilipenko commented 8 years ago

@atis-- why do you change name in package.json?

atis-- commented 8 years ago

Eh sorry, should have created a pull request on a separate branch. I changed the name to publish on npm for personal use. Do you want me to re-submit a fixed pull request or will you fix it yourself?

atis-- commented 8 years ago

Ok, reverted the mistake in a new commit.