@qrvey/utils 1.16.0-6 → 1.16.0-7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -131,7 +131,10 @@ class DurationFormatter {
131
131
  let _number = number;
132
132
  _number *= this.numberFactor;
133
133
  const durationParts = this.parts.reduce((store, part) => {
134
- store[part.symbol] = Math.floor(_number / part.ms);
134
+ const roundDuration = Math.floor(Math.abs(_number / part.ms));
135
+ const durationValid = roundDuration * (_number < 0 ? -1 : 1);
136
+ store[part.symbol] =
137
+ durationValid === 0 ? Math.abs(durationValid) : durationValid;
135
138
  _number %= part.ms;
136
139
  return store;
137
140
  }, {});
@@ -128,7 +128,10 @@ export class DurationFormatter {
128
128
  let _number = number;
129
129
  _number *= this.numberFactor;
130
130
  const durationParts = this.parts.reduce((store, part) => {
131
- store[part.symbol] = Math.floor(_number / part.ms);
131
+ const roundDuration = Math.floor(Math.abs(_number / part.ms));
132
+ const durationValid = roundDuration * (_number < 0 ? -1 : 1);
133
+ store[part.symbol] =
134
+ durationValid === 0 ? Math.abs(durationValid) : durationValid;
132
135
  _number %= part.ms;
133
136
  return store;
134
137
  }, {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.16.0-6",
3
+ "version": "1.16.0-7",
4
4
  "description": "Helper, Utils for all Qrvey Projects",
5
5
  "homepage": "https://bitbucket.org/qrvey/qrvey_utils/wiki/Home",
6
6
  "main": "dist/index.js",