要开始在 Node.js 项目中使用 Day.js,只需将依赖添加到 Node.js 包管理器即可。 npm install dayjs # or yarn add dayjs # or pnpm add dayjs 然后将其包含在你的脚本中: const dayjs = require('dayjs') //import dayjs from 'dayjs' // ES 2015 dayjs().format() 请在此处查看有关加载 语言环境 和 插件 的更多信息。