Giter Site home page Giter Site logo

adi961 / moment Goto Github PK

View Code? Open in Web Editor NEW

This project forked from moment/moment

0.0 0.0 0.0 16.55 MB

Parse, validate, manipulate, and display dates in javascript.

Home Page: momentjs.com

License: MIT License

JavaScript 99.82% Shell 0.01% TypeScript 0.17%

moment's People

Contributors

alexstrat avatar ashsearle avatar caillou avatar damianfekete avatar eternicode avatar fbonzon avatar ianwremmel avatar icambron avatar ichernev avatar jbleduigou avatar kkopanidis avatar kruyvanna avatar maggiepint avatar mar-chi-pan avatar marwahaha avatar mattjohnsonpint avatar mbad0la avatar mdxs avatar mrtnjrrtt avatar nrbgt avatar raphamorim avatar szelga avatar timfish avatar timrwood avatar tracygjg avatar vajradog avatar vnathalye avatar weldan avatar wi-ski avatar xotic750 avatar

Watchers

 avatar  avatar  avatar

moment's Issues

Support for adding and subtracting centuries

Is your feature request related to a problem? Please describe.
For my current project, I need methods to add and subtract centuries of a date.
Describe the solution you'd like
The already existent functions for adding and subtract should be able to accept a parameter for century. For example moment().add(2, 'century'). And a shorthand C

Describe alternatives you've considered
It would be possible to add or subtract by using moment().add(<number of years> * 100, 'years')

Additional context
For implementing this feature the constructor in src/lib/duration/constructor.js has to be changed to support centuries. A file similar to src/lib/units/century.js has to be created and imported in src/lib/units/units.js

Add/Subtract centuries functionality

Is your feature request related to a problem? Please describe.
I'm currently working on a web project for an history learning plattform and therefore I want to create an interactive timeline which is based on dates. For this feature I need the ability to add/subtract centuries to an existing moment object.

Describe the solution you'd like
I need the existing functionality "add"/"subtract" with the possibility to hand over centuries instead of days, hours, weeks, etc as a parameter.

Example:
var date = moment(); // -> 2017-06-07
date.subtract(1, 'c');
// date -> 1917-06-07

Describe alternatives you've considered
At the moment I'm using the years function and always add/subtract 100 years but it would be easier to use a century functionality

Adding centuries

Add the "centuries" unit so that you can add / subtract entire centuries.

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.