Momentjs-humanize
提供:Dev Guides
MomentJS-ヒューマナイズ
このメソッドは、人間が読める形式で日付を表示します。
構文
moment.duration().humanize();
例
var a = moment.duration(24, "hours").humanize();
出力
出力に ago や in などのサフィックスが必要な場合は、次のようにtrueを追加して人間化してください。
例
var a = moment.duration(24, "hours").humanize(true);
出力
例
var a = moment.duration(-1, "days").humanize(true);