Sha256: 2ab0781a758c54eaf0eb24aafff452d6bbe3ae04cdbf0825aad627fa0a3ef0a2

Contents?: true

Size: 990 Bytes

Versions: 41

Compression:

Stored size: 990 Bytes

Contents

import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addUnitPriority } from './priorities';
import { addRegexToken, match3, match1to3 } from '../parse/regex';
import { daysInYear } from './year';
import { createUTCDate } from '../create/date-from-array';
import { addParseToken } from '../parse/token';
import toInt from '../utils/to-int';

// FORMATTING

addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');

// ALIASES

addUnitAlias('dayOfYear', 'DDD');

// PRIORITY
addUnitPriority('dayOfYear', 4);

// PARSING

addRegexToken('DDD',  match1to3);
addRegexToken('DDDD', match3);
addParseToken(['DDD', 'DDDD'], function (input, array, config) {
    config._dayOfYear = toInt(input);
});

// HELPERS

// MOMENTS

export function getSetDayOfYear (input) {
    var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
    return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
}

Version data entries

41 entries across 40 versions & 9 rubygems

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