Node.js
要在你的 Node.js 專案中使用 Day.js,只需將其作為依賴項新增到你的 Node.js 套件管理器中。
bash
npm install dayjs
# 或
yarn add dayjs
# 或
pnpm add dayjs
然後在你的腳本中引入 Day.js:
js
const dayjs = require('dayjs');
// import dayjs from 'dayjs' // ES 2015
dayjs().format();
請參閱此處以獲取更多關於載入 locale (語言) 和 plugin (插件) 的資訊。