moment-round
This is a plugin for moment.js and will round date/time to a given interval.
This fork by SpotOn only supports CommonJS by default, which will work with Node and with Webpack. If you need other loaders, you'll need to change our Babel setup to whatever you need.
Examples
var m = ;m; // 2015-06-18 15:30:19.123m; // 2015-06-18 15:30:20.100m; // 2015-06-18 15:30:20.000m; // 2015-06-18 15:33:00.000m; // 2015-06-18 00:00:00.000m; // 2015-06-18 21:00:00.000m; // 2015-06-19 00:00:00.000
Possible values to round to are hours
, minutes
, seconds
, milliseconds
Alias values
mm --> millisecondsMilliseconds --> millisecondsmillisecond --> millisecondss --> secondsSeconds --> secondssecond --> secondsm --> minutesMinutes --> minutesminute --> minutesh --> hoursH --> hoursHours --> hourshour --> hours
Installation
Browser
Node /NPM
npm install moment-round --save-dev
And then require
it:
var moment = ;;
Bower
bower install moment-round
Running tests
gulp test
License
moment-round is LICENSED.