From 59d4351ad8fc042bc263a16ed45a56e9ff5b013e Mon Sep 17 00:00:00 2001 From: Phablulo Joel Date: Wed, 24 Oct 2018 14:58:25 -0300 Subject: [PATCH] fix(transition): handle local-formatted floats in toMs function. (#8495) fix #4894 --- src/platforms/web/runtime/transition-util.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/platforms/web/runtime/transition-util.js b/src/platforms/web/runtime/transition-util.js index 706210141fc..0885f973f89 100644 --- a/src/platforms/web/runtime/transition-util.js +++ b/src/platforms/web/runtime/transition-util.js @@ -181,6 +181,10 @@ function getTimeout (delays: Array, durations: Array): number { })) } +// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers +// in a locale-dependent way, using a comma instead of a dot. +// If comma is not replaced with a dot, the input will be rounded down (i.e. acting +// as a floor function) causing unexpected behaviors function toMs (s: string): number { - return Number(s.slice(0, -1)) * 1000 + return Number(s.slice(0, -1).replace(',', '.')) * 1000 }