GithubHelp home page GithubHelp logo

kissmetrics / moment-round Goto Github PK

View Code? Open in Web Editor NEW

This project forked from webdevtmas/moment-round

0.0 7.0 1.0 13 KB

Plugin for momentjs to round time in dates.

License: Other

JavaScript 100.00%

moment-round's Introduction

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.

moment-round's People

Contributors

webdevtmas avatar cjsewell avatar

Watchers

Nick Murphy avatar Chris O'Hara avatar James Cloos avatar Nathaniel Wroblewski avatar Kissmetrics Robot avatar Paul O'Leary avatar Eric du Toit avatar

Forkers

isabella232

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.