Skip to content

关于自动创建文件夹的时间戳,希望从浏览器读取时区,并修改下时间戳的生成 #4

@nixingshiguang

Description

@nixingshiguang

遇到的问题
我在东八区,但是发现在为自动创建文件夹生成的时间戳和我在的时区并不相符

建议
从浏览器获取时区,并生成时间戳

const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
const folderName = new Date()
  .toLocaleString("zh-CN", {timeZone: "Asia/Shanghai"})
  .replace(/[^\d]/g, "")

或者提供变量,让用户自行选择或者设定时区

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions