【JS】【TS】Day.js ~ 入門編 ~

■ はじめに

https://dk521123.hatenablog.com/entry/2021/01/29/231952
https://dk521123.hatenablog.com/entry/2021/01/30/232708

の続き。

今回は、Day.js を調べてみた。

目次

【1】Day.js
【2】公式サイト
【3】環境設定
【4】サンプル

【1】Day.js

* 軽量

【2】公式サイト

https://day.js.org/

【3】環境設定

npm install dayjs --save

【4】サンプル

import * as dayjs from 'dayjs';

dayjs.locale('ja');
const targetDate  = dayjs().format('YYYY/MM/DD HH:mm:ss');
console.log(targetDate); // 2021/01/31 21:26:12

参考文献

https://www.wakuwakubank.com/posts/743-javascript-dayjs/
https://qiita.com/tobita0000/items/0f9d0067398efdc2931e
https://www.webopixel.net/javascript/1460.html

関連記事

TypeScript での 日付 / 日時 の扱い
https://dk521123.hatenablog.com/entry/2021/01/29/231952
date-fns ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2021/01/30/232708
TypeScript ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2020/12/21/180904