corrade-nucleus-nucleons – Blame information for rev 38

Subversion Repositories:
Rev:
Rev Author Line No. Line
38 office 1 import { addFormatToken } from '../format/format';
2 import { addUnitAlias } from './aliases';
3 import { addUnitPriority } from './priorities';
4 import { addRegexToken, match1 } from '../parse/regex';
5 import { addParseToken } from '../parse/token';
6 import { MONTH } from './constants';
7 import toInt from '../utils/to-int';
8  
9 // FORMATTING
10  
11 addFormatToken('Q', 0, 'Qo', 'quarter');
12  
13 // ALIASES
14  
15 addUnitAlias('quarter', 'Q');
16  
17 // PRIORITY
18  
19 addUnitPriority('quarter', 7);
20  
21 // PARSING
22  
23 addRegexToken('Q', match1);
24 addParseToken('Q', function (input, array) {
25 array[MONTH] = (toInt(input) - 1) * 3;
26 });
27  
28 // MOMENTS
29  
30 export function getSetQuarter (input) {
31 return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
32 }