duration-time-format
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -52,3 +52,3 @@ (function (global, factory) { | ||
var defaultConfig = { | ||
colonNumber: 3, | ||
colonNumber: 2, | ||
keepDecimals: 2, | ||
@@ -89,3 +89,3 @@ alwaysDisplayDecimals: false, | ||
sec = Math.floor(sec); | ||
var n = this.colonNumber; | ||
var n = this.colonNumber + 1; | ||
for (var i = 1; i <= n; ++i) { | ||
@@ -92,0 +92,0 @@ if (i > 1) { |
{ | ||
"name": "duration-time-format", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Duration Time Format/Parse", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,3 +14,3 @@ Duration Time | ||
DurationTime({ | ||
colonNumber: 2 | ||
colonNumber: 1 | ||
}).format(11111) === '185:11' | ||
@@ -17,0 +17,0 @@ |
@@ -29,11 +29,11 @@ const DurationTime = require('../../index') | ||
it('Format', function () { | ||
expect(DurationTime({colonNumber: 1}).format(111)).toBe('111') | ||
expect(DurationTime({colonNumber: 2}).format(111)).toBe('01:51') | ||
expect(DurationTime({colonNumber: 3}).format(111)).toBe('00:01:51') | ||
expect(DurationTime({colonNumber: 4}).format(111)).toBe('00:00:01:51') | ||
expect(DurationTime({colonNumber: 0}).format(111)).toBe('111') | ||
expect(DurationTime({colonNumber: 1}).format(111)).toBe('01:51') | ||
expect(DurationTime({colonNumber: 2}).format(111)).toBe('00:01:51') | ||
expect(DurationTime({colonNumber: 3}).format(111)).toBe('00:00:01:51') | ||
expect(DurationTime({colonNumber: 2}).format(1111)).toBe('18:31') | ||
expect(DurationTime({colonNumber: 1}).format(1111)).toBe('18:31') | ||
expect(DurationTime().format(1111)).toBe('00:18:31') | ||
expect(DurationTime({colonNumber: 2}).format(11111)).toBe('185:11') | ||
expect(DurationTime({colonNumber: 1}).format(11111)).toBe('185:11') | ||
expect(DurationTime({hasLeadingZero: false}).format(11111)).toBe('3:5:11') | ||
@@ -40,0 +40,0 @@ expect(DurationTime().format(11111)).toBe('03:05:11') |
@@ -9,3 +9,3 @@ /** | ||
const defaultConfig = { | ||
colonNumber: 3, | ||
colonNumber: 2, | ||
keepDecimals: 2, | ||
@@ -40,3 +40,3 @@ alwaysDisplayDecimals: false, | ||
sec = Math.floor(sec) | ||
let n = this.colonNumber | ||
let n = this.colonNumber + 1 | ||
for (let i = 1; i <= n; ++i) { | ||
@@ -43,0 +43,0 @@ if (i > 1) { |
11571