date-manip
Note: A modern JavaScript Date utility library delivering modularity, performance, & extras.
Installation
Load date-manip
via classical <script>
tag
<script src="https://cdn.jsdelivr.net/npm/date-manip/date-manip.umd.min.js"></script>
<script>
dateManip.add
dateManip.format
</script>
<script src="https://cdn.jsdelivr.net/npm/date-manip/date-chain.umd.min.js"></script>
<script>
DateChain.add
DateChain.format
var now = new DateChain();
now.add
now.format
</script>
CommonJS style with npm
npm install date-manip --save
import {
add,
format,
} from 'date-manip';
import { ... } from 'date-manip/es';
import add from 'date-manip/add';
import format from 'date-manip/format';
import moment from 'date-manip/date-chain';
moment('2000-2-29')
.add({
year: 1,
month: 1,
day: 1,
hour: 1,
minute: 1,
second: 1,
millisecond: 1
})
.add(1, 'month')
.startOf('date')
.format('YYYY-MM-DD');
API
- add
- addDays
- addHours
- addMilliseconds
- addMinutes
- addMonths
- addSeconds
- addYears
- clone
- dayOfYear
- daysInMonth
- diff
- endOf
- format
- get
- isAfter
- isBefore
- isBetween
- isLeapYear
- isSame
- isSameOrAfter
- isSameOrBefore
- isValid
- parse
- set
- startOf
- subtract