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

spacetime.whereIts returns an array of timezones names lowercased #212

Open
imns opened this issue Jun 23, 2020 · 4 comments
Open

spacetime.whereIts returns an array of timezones names lowercased #212

imns opened this issue Jun 23, 2020 · 4 comments

Comments

@imns
Copy link

imns commented Jun 23, 2020

Title pretty much says it all. If I call spacetime.whereIts('4pm') it returns:

[                                                                                                                                                                                                                                                                                                                                                                 
  'america/lima',
  'america/rio_branco',
  'brazil/acre',
  'america/bahia_banderas',
  'america/merida',
  'america/mexico_city',
  'america/monterrey',
  'mexico/general',
  'america/north_dakota',
  'america/chicago',
  'america/knox_in',
  'america/matamoros',
  'america/menominee',
  'america/rainy_river',
  'america/rankin_inlet',
  'america/resolute',
  ...
]

I would expect the timezone names to be in the same format as in the documentation ie: "America/Jamaica" as referenced here https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.

@imns
Copy link
Author

imns commented Jun 23, 2020

As a quick/dirty fix I did this, but I'm certain it doesn't cover all the edge cases:

function titleCase(str) {
	return str
		.toLowerCase()
		.split("_")
		.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
		.join("_")
		.replace("Gmt", "GMT");
}
const tzs = spacetime.whereIts("4pm").map((tz) => {
	let [country, region] = tz.split("/");
	return `${titleCase(country)}/${titleCase(region)}`;
});

@spencermountain
Copy link
Owner

ah, yeah you're right.
I'll add this to the next major.

yeah - there is America/Port-au-Prince and Antarctica/DumontDUrville, and also the GMT ones and things.
thanks for the heads-up

@Great-hijack
Copy link

Thanks for this great library. 🎉

When can we expect the next release with this resolved?

@spencermountain
Copy link
Owner

hey @Great-hijack - sorry for the delay on this. Fraid v8 is looking like mid-summer.
cheers

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

No branches or pull requests

3 participants