日付操作のライブラリMoment.js
今現在のの日付を取得する
・moment();
文字列からオブジェクトを生成する
・moment('2020-06-01 00:00:00');
日時の加減算
加算
・moment().add(数字,文字('y'/'M'/'w'/'d'/'h'/'m'/'s'));
減算
・moment().subtract(数字,文字('y'/'M'/'w'/'d'/'h'/'m'/'s'));
日時の比較
a = moment('2018-09-01 06:00:00')
b = moment('2018-10-01 06:00:00')
c = moment('2018-11-01 06:00:00')
b.isAfter(a) // true
b.isAfter(b) // false
b.isAfter(c) // false
b.isSame(a) // false
b.isSame(b) // true
b.isSame(c) // false
b.isBefore(a) // false
b.isBefore(b) // false
b.isBefore(c) // true
b.isSameOrAfter(a) // true
b.isSameOrAfter(b) // true
b.isSameOrAfter(c) // false
b.isSameOrBefore(a) // false
b.isSameOrBefore(b) // true
b.isSameOrBefore(c) // true
b.isBetween(a, c) // true
c.isBetween(a, b) // false