Sha256: 8739f6f03010e4e096310680bd2d342427f4b4e5bb84458cef058c29dd1dc6a2

Contents?: true

Size: 1.1 KB

Versions: 9

Compression:

Stored size: 1.1 KB

Contents

import { makeGetSet } from '../moment/get-set';
import { addFormatToken } from '../format/format';
import { addUnitAlias } from './aliases';
import { addRegexToken, match1, match2, match3, match1to3, matchUnsigned } from '../parse/regex';
import { addParseToken } from '../parse/token';
import { MILLISECOND } from './constants';
import toInt from '../utils/to-int';

// FORMATTING

addFormatToken('S', 0, 0, function () {
    return ~~(this.millisecond() / 100);
});

addFormatToken(0, ['SS', 2], 0, function () {
    return ~~(this.millisecond() / 10);
});

function milliseconds (token) {
    addFormatToken(0, [token, 3], 0, 'millisecond');
}

milliseconds('SSS');
milliseconds('SSSS');

// ALIASES

addUnitAlias('millisecond', 'ms');

// PARSING

addRegexToken('S',    match1to3, match1);
addRegexToken('SS',   match1to3, match2);
addRegexToken('SSS',  match1to3, match3);
addRegexToken('SSSS', matchUnsigned);
addParseToken(['S', 'SS', 'SSS', 'SSSS'], function (input, array) {
    array[MILLISECOND] = toInt(('0.' + input) * 1000);
});

// MOMENTS

export var getSetMillisecond = makeGetSet('Milliseconds', false);

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
sedge_cms-0.0.1 vendor/assets/components/moment/src/lib/units/millisecond.js
date_picker-0.0.6 test/dummy/vendor/assets/components/moment/src/lib/units/millisecond.js
date_picker-0.0.5 test/dummy/vendor/assets/components/moment/src/lib/units/millisecond.js
date_picker-0.0.4 test/dummy/vendor/assets/components/moment/src/lib/units/millisecond.js
date_picker-0.0.3 test/dummy/vendor/assets/components/moment/src/lib/units/millisecond.js
date_picker-0.0.2 test/dummy/vendor/assets/components/moment/src/lib/units/millisecond.js
date_picker-0.0.1 test/dummy/vendor/assets/components/moment/src/lib/units/millisecond.js
puppet-herald-0.8.1 lib/puppet-herald/public/bower_components/moment/src/lib/units/millisecond.js
puppet-herald-0.8.0 lib/puppet-herald/public/bower_components/moment/src/lib/units/millisecond.js