1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Vue】day.jsを使って時間を表示する。

Posted at

#day.jsとは

ずばり日付に関するライブラリです。

#day.jsの導入方法

以下のnpm、yarnを使ってインストールします。

  • npm
npm install dayjs --save
  • yarn
yarn add dayjs

#導入手順
###1.ライブラリの取り込み

import dayjs from "dayjs";

dayjs.locale("ja");
Vue.prototype.$dayjs = dayjs;

###2.テンプレートを準備

<div class="mytime">{{ $dayjs(time).format("hh:mm") }}</div>

#細かく日時を設定したい場合

公式リファレンスを参照してください。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?