我有一个nodejs服务器,我正在从他那里发送消息。 我想通过接收器本地化数据格式化日期。如果他来自美国,那么时间将为下午 2:00,如果他来自英国,时间将为 14:00。 我有用户时区。
尝试使用时刻时区
import momentTimezone from "https://esm.sh/moment-timezone";
console.log(momentTimezone().tz("America/Los_Angeles").format())
console.log(momentTimezone().tz("Europe/London").format())