How to use the period function from moment

Find comprehensive JavaScript moment.period code examples handpicked from public code repositorys.

6
7
8
9
10
11
12
13
14
15

// This will enable us to specify a period (week, month, year) with an added or substracted value.
// For example, week+2, month+4, etc...
this.parsePeriod = function(json) {
    // We apply some period analysis (TODO see where to do this in a more business dedicated object)
    var range1 = moment.period(json.startDate);
    var range2 = moment.period(json.endDate);

    // The first date can be used to only define a period (current month, year, etc...)
    if (range1 !== undefined) {
fork icon1
star icon5
watch icon2

+ 11 other calls in file