adi961 / moment Goto Github PK
View Code? Open in Web Editor NEWThis project forked from moment/moment
Parse, validate, manipulate, and display dates in javascript.
Home Page: momentjs.com
License: MIT License
This project forked from moment/moment
Parse, validate, manipulate, and display dates in javascript.
Home Page: momentjs.com
License: MIT License
Critical problem when calling century.
After adding a century to an existing date, the date object isn't valid anymore.
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
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
Add the "centuries" unit so that you can add / subtract entire centuries.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.