formkit / tempo

📆 Parse, format, manipulate, and internationalize dates and times in JavaScript and TypeScript.
https://tempo.formkit.com
MIT License
2.37k stars 33 forks source link

Error: Invalid time zone specified: Etc/Unknown #63

Closed brandanking-decently closed 4 months ago

brandanking-decently commented 4 months ago

We are looking to move from Date-fns to your package. However, currently when running the following

format(new Date(), "do MMMM yyyy")

from a server component we get the following Error: Invalid time zone specified: Etc/Unknown When we run our NextJS app we run set TZ=UTC && next dev to emulate our server environments running against UTC

justin-schroeder commented 4 months ago

You'll need your environment to have a time zone for tell to work well. Most node environments automatically use the host machine's TZ. Typically just doing TZ=UTC next dev would be sufficient however this ultimately depends on where node is getting its time zone from. Should be relatively easy to debug on your machine.

The other thing to note is the format you specified includes an ordinal which Tempo does not yet support.