0
1

More than 3 years have passed since last update.

Tempus Dominus Bootstrap 4 で日本語表記を変更

Posted at

日本語環境で設置したらカレンダーのヘッダー表示が「一月 2019」のようになる。

設定値は以下のファイルで行っている模様。
node_modules/moment/locale/ja.jsのmonthsプロパティが以下のようになっている。

months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),

直接直してもいいけど、
カレンダーのヘッダ表示を編集するにはdayViewHeaderFormatを指定する。

    $('#datetimepicker1').datetimepicker({
        format: 'L',
        locale: 'ja',
        dayViewHeaderFormat: 'YYYY年 MMM',
    });
});

フォーマットの形式YYYYで西暦4桁数値、MMMMでmonths、MMMでmonthsShortを使用する。

0
1
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
0
1