From e1546d1a0cdb97ae92cf11efe61d94707af6a3a3 Mon Sep 17 00:00:00 2001 From: mateuszpigula <34506960+mateuszpigula@users.noreply.github.com> Date: Wed, 3 Mar 2021 06:57:47 +0100 Subject: [PATCH] fix: Update duration plugin change string to number (#1394) --- src/plugin/duration/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugin/duration/index.js b/src/plugin/duration/index.js index 45083403..854c7463 100644 --- a/src/plugin/duration/index.js +++ b/src/plugin/duration/index.js @@ -79,7 +79,9 @@ class Duration { if (typeof input === 'string') { const d = input.match(durationRegex) if (d) { - [,, + const properties = d.slice(2) + const numberD = properties.map(value => Number(value)); + [ this.$d.years, this.$d.months, this.$d.weeks, @@ -87,7 +89,7 @@ class Duration { this.$d.hours, this.$d.minutes, this.$d.seconds - ] = d + ] = numberD this.calMilliseconds() return this }