aboutsummaryrefslogtreecommitdiffstats
path: root/bower_components/moment/src/lib/units/millisecond.js
diff options
context:
space:
mode:
Diffstat (limited to 'bower_components/moment/src/lib/units/millisecond.js')
-rw-r--r--bower_components/moment/src/lib/units/millisecond.js38
1 files changed, 30 insertions, 8 deletions
diff --git a/bower_components/moment/src/lib/units/millisecond.js b/bower_components/moment/src/lib/units/millisecond.js
index 2fb73af..134d88e 100644
--- a/bower_components/moment/src/lib/units/millisecond.js
+++ b/bower_components/moment/src/lib/units/millisecond.js
@@ -16,12 +16,26 @@ addFormatToken(0, ['SS', 2], 0, function () {
return ~~(this.millisecond() / 10);
});
-function milliseconds (token) {
- addFormatToken(0, [token, 3], 0, 'millisecond');
-}
+addFormatToken(0, ['SSS', 3], 0, 'millisecond');
+addFormatToken(0, ['SSSS', 4], 0, function () {
+ return this.millisecond() * 10;
+});
+addFormatToken(0, ['SSSSS', 5], 0, function () {
+ return this.millisecond() * 100;
+});
+addFormatToken(0, ['SSSSSS', 6], 0, function () {
+ return this.millisecond() * 1000;
+});
+addFormatToken(0, ['SSSSSSS', 7], 0, function () {
+ return this.millisecond() * 10000;
+});
+addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
+ return this.millisecond() * 100000;
+});
+addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
+ return this.millisecond() * 1000000;
+});
-milliseconds('SSS');
-milliseconds('SSSS');
// ALIASES
@@ -32,11 +46,19 @@ addUnitAlias('millisecond', 'ms');
addRegexToken('S', match1to3, match1);
addRegexToken('SS', match1to3, match2);
addRegexToken('SSS', match1to3, match3);
-addRegexToken('SSSS', matchUnsigned);
-addParseToken(['S', 'SS', 'SSS', 'SSSS'], function (input, array) {
+
+var token;
+for (token = 'SSSS'; token.length <= 9; token += 'S') {
+ addRegexToken(token, matchUnsigned);
+}
+
+function parseMs(input, array) {
array[MILLISECOND] = toInt(('0.' + input) * 1000);
-});
+}
+for (token = 'S'; token.length <= 9; token += 'S') {
+ addParseToken(token, parseMs);
+}
// MOMENTS
export var getSetMillisecond = makeGetSet('Milliseconds', false);