Fix floating point error for poll expiry
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful

Previous code multiply with 0.001 before multiplication which leads to a
floating point error.  By changing it to division by 1000 after
multiplication this is avoided.
This commit is contained in:
Ngô Ngọc Đức Huy 2023-03-24 20:44:29 +07:00
parent 7e1b1e79f4
commit 47fc082fb9
Signed by untrusted user: xarvos
GPG key ID: 904AF1C7CDF695C3

View file

@ -103,9 +103,9 @@ export default {
convertExpiryFromUnit (unit, amount) { convertExpiryFromUnit (unit, amount) {
// Note: we want seconds and not milliseconds // Note: we want seconds and not milliseconds
switch (unit) { switch (unit) {
case 'minutes': return 0.001 * amount * DateUtils.MINUTE case 'minutes': return amount * DateUtils.MINUTE / 1000
case 'hours': return 0.001 * amount * DateUtils.HOUR case 'hours': return amount * DateUtils.HOUR / 1000
case 'days': return 0.001 * amount * DateUtils.DAY case 'days': return amount * DateUtils.DAY / 1000
} }
}, },
expiryAmountChange () { expiryAmountChange () {