Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Timezone support with date-fns

I'm considering migrating my project using moment into date-fns which is known as simple, functional etc. But after I played with it a while, I noticed they don't support timezone yet. They have introduced locale and timezone option in format and other functionality in alpha 2.0.0 lately but the locale option is just a language support and the timezone option in those functions just shows/adds the GMT sign(ex. 2018.08.29 GMT+9). So I was wondering if I'm just missing it although they already support it or they really haven't supported it yet.

like image 375
DongBin Kim Avatar asked Oct 25 '25 05:10

DongBin Kim


1 Answers

There is date-fns-timezone which works with date-fns v1, and date-fns-tz for date-fns v2.

See the official timezone documentation from date-fns, that points to date-fns-tz

like image 171
pdpino Avatar answered Oct 26 '25 23:10

pdpino