Sha256: 1ec28fa5bd5af6a665f464d0e3486ff58536b4c0449c25e3284ecc984ecc8302

Contents?: true

Size: 763 Bytes

Versions: 41

Compression:

Stored size: 763 Bytes

Contents

import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addUnitPriority } from './priorities';
import { addRegexToken, match1 } from '../parse/regex';
import { addParseToken } from '../parse/token';
import { MONTH } from './constants';
import toInt from '../utils/to-int';

// FORMATTING

addFormatToken('Q', 0, 'Qo', 'quarter');

// ALIASES

addUnitAlias('quarter', 'Q');

// PRIORITY

addUnitPriority('quarter', 7);

// PARSING

addRegexToken('Q', match1);
addParseToken('Q', function (input, array) {
    array[MONTH] = (toInt(input) - 1) * 3;
});

// MOMENTS

export function getSetQuarter (input) {
    return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
}

Version data entries

41 entries across 40 versions & 9 rubygems

Version Path
card-1.100.0 mod/date/vendor/moment/src/lib/units/quarter.js
card-1.99.6 mod/date/vendor/moment/src/lib/units/quarter.js
card-1.99.5 mod/date/vendor/moment/src/lib/units/quarter.js
card-1.99.4 mod/date/vendor/moment/src/lib/units/quarter.js
card-1.99.3 mod/date/vendor/moment/src/lib/units/quarter.js
card-1.99.2 mod/date/vendor/moment/src/lib/units/quarter.js
ilog-0.4.1 node_modules/moment/src/lib/units/quarter.js
ilog-0.4.0 node_modules/moment/src/lib/units/quarter.js
ilog-0.3.3 node_modules/moment/src/lib/units/quarter.js
card-1.99.1 mod/date/vendor/moment/src/lib/units/quarter.js
card-1.99.0 mod/date/vendor/moment/src/lib/units/quarter.js
jester-data-8.0.0 node_modules/moment/src/lib/units/quarter.js
ezii-os-5.2.1 node_modules/moment/src/lib/units/quarter.js
ezii-os-2.0.1 node_modules/moment/src/lib/units/quarter.js
card-1.98.3 mod/date/vendor/moment/src/lib/units/quarter.js
card-1.98.2 mod/date/vendor/moment/src/lib/units/quarter.js
card-1.98.1 mod/date/vendor/moment/src/lib/units/quarter.js
card-1.98.0 mod/date/vendor/moment/src/lib/units/quarter.js
card-1.97.0.1 mod/date/vendor/moment/src/lib/units/quarter.js
card-1.97.0 mod/date/vendor/moment/src/lib/units/quarter.js