Moment.js:簡単な日付処理


Moment.jsは優れたJavaScript日付ライブラリです。 カットの下の例。

var now = moment(); moment.lang('ru'); console.log(now.format('dddd, MMMM DD YYYY, h:mm:ss')); // ,  15 2011, 3:31:03 


 var halloween = moment([2011, 9, 31]); // October 31st moment.lang('ru'); console.log(halloween.fromNow()); // 16   


 var now = moment().add('days', 9); moment.lang('ru'); console.log(now.format('dddd, MMMM DD YYYY')); // ,  24 2011 


 var now = moment(); moment.lang('ru'); console.log(now.format('LLLL')); // , 15  2011 15:27 


さて、実際のリンク:
オフサイト | ドキュメンテーション | github

PS私の意見では、日付を扱うのに最も適切です。 ロシア語の通常のサポートを終了するだけです。

Source: https://habr.com/ru/post/J132654/


All Articles