moment-rcf
v1.0.2
Published
Rounding methods for momentjs
Downloads
102
Maintainers
Readme
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