[英]Given local DateTime and lat/lon, how to determine a timezone and offset in NodeJs?
In the past I implemented C# library which, given local DateTime and lat/lon , allowed to determine a timezone and offset . 过去,我实现了C#库,该库在给定本地DateTime和lat / lon的情况下允许确定时区和offset 。
I did the following: 我做了以下事情:
Noda Time C# library was used to get all necessary information about timezone, offset, and DST. Noda Time C#库用于获取有关时区,偏移量和DST的所有必要信息。 It returns:
它返回:
Now I need to reproduce this library in NodeJs + PostgreSQL. 现在,我需要在NodeJs + PostgreSQL中重现该库。 Is the suggested way of doing it:
是这样做的建议方法:
Are there known pitfalls, difficulties? 有已知的陷阱,困难吗?
As you said, you need some actualized shapefile to map all timezones by geo coordinates . 如您所说,您需要一些实际的shapefile来通过geo坐标映射所有时区 。
You can use a module like geo-tz
that natively support moment-timezone
library. 您可以使用像
geo-tz
这样的模块,该模块本身支持moment-timezone
库。 Or a more lightweight one like tz-lookup
. 或更轻巧的像
tz-lookup
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.