Brought in another asset for Ray's eye form: moment
[openemr.git] / public / assets / moment-2-13-0 / src / lib / units / quarter.js
blob78543a68312ce282b0c15a6cfad8df3f4e51a5ce
1 import { addFormatToken } from '../format/format';
2 import { addUnitAlias } from './aliases';
3 import { addRegexToken, match1 } from '../parse/regex';
4 import { addParseToken } from '../parse/token';
5 import { MONTH } from './constants';
6 import toInt from '../utils/to-int';
8 // FORMATTING
10 addFormatToken('Q', 0, 'Qo', 'quarter');
12 // ALIASES
14 addUnitAlias('quarter', 'Q');
16 // PARSING
18 addRegexToken('Q', match1);
19 addParseToken('Q', function (input, array) {
20     array[MONTH] = (toInt(input) - 1) * 3;
21 });
23 // MOMENTS
25 export function getSetQuarter (input) {
26     return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);