Skip to content

isabella232/moment-round

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

moment-round

This is a plugin for moment.js and will round date/time to a given interval.

Examples

var m = new moment(); // 2015-06-18 15:30:19
moment.round(5, 'seconds'); // 2015-06-18 15:30:20
moment.ceil(3, 'minutes'); // 2015-06-18 15:33:00
moment.floor(16, 'hours'); // 2015-06-18 00:00:00
moment.ceil(21, 'hours'); // 2015-06-18 21:00:00
moment.ceil(20, 'hours'); // 2015-06-19 00:00:00

Possible values to round to are hours, minutes, seconds

Installation

Browser

<script src="moment.js"></script>
<script src="moment-round.js"></script>

Node /NPM

npm install moment-round --save-dev

And then require it:

var moment = require('moment');
require('moment-round');

Bower

bower install moment-round

Running tests

gulp test

License

moment-round is LICENSED.

About

Plugin for momentjs to round time in dates.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%