spacetime
spacetime copied to clipboard
`spacetime.whereIts` returns an array of timezones names lowercased
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.
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)}`;
});
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
Thanks for this great library. 🎉
When can we expect the next release with this resolved?
hey @Great-hijack - sorry for the delay on this. Fraid v8 is looking like mid-summer. cheers