moment-rcf

1.0.2 • Public • Published

moment-rcf

This is a plugin for moment.js. It implements the methods round(), ceil() and floor() which can be used for hours, minutes, seconds and milliseconds.

Usage

var moment = require("moment");
require("moment-rcf");
 
var m = moment('25.02.2017 02:52:26.142','DD.MM.YYYY HH:mm:ss.SSS');
m.round(5, "Minutes").format('DD.MM.YYYY HH:mm:ss.SSS') ); // 25.02.2017 02:50:00.000
m.ceil( 5, "Minutes").format('DD.MM.YYYY HH:mm:ss.SSS') ); // 25.02.2017 02:55:00.000
m.floor(5, "Minutes").format('DD.MM.YYYY HH:mm:ss.SSS') ); // 25.02.2017 02:50:00.000
m.round(5, "Hours"  ).format('DD.MM.YYYY HH:mm:ss.SSS') ); // 25.02.2017 05:00:00.000

Installation

npm install moment-rcf

Testing

npm test

Licence

MIT

Package Sidebar

Install

npm i moment-rcf

Weekly Downloads

16

Version

1.0.2

License

MIT

Last publish

Collaborators

  • jfm-made