@naturalcycles/time-lib
Advanced tools
Comparing version 1.6.6 to 1.6.7
@@ -0,1 +1,8 @@ | ||
## [1.6.7](https://github.com/NaturalCycles/time-lib/compare/v1.6.6...v1.6.7) (2019-11-14) | ||
### Bug Fixes | ||
* ms returning 1h59m instead of 59m ([970cba5](https://github.com/NaturalCycles/time-lib/commit/970cba503bd347fa598748e140f1a3e0ad6abe78)) | ||
## [1.6.6](https://github.com/NaturalCycles/time-lib/compare/v1.6.5...v1.6.6) (2019-11-11) | ||
@@ -2,0 +9,0 @@ |
@@ -24,11 +24,12 @@ export const TS_2018_06_21 = 1529539200; | ||
return `${(millis / 1000).toFixed(3)} sec`; | ||
// <1 min | ||
if (millis < 60 * 1000) | ||
return `${Math.round(millis / 1000)} sec`; | ||
const sec = Math.round(millis / 1000) % 60; | ||
const min = Math.round(millis / (60 * 1000)) % 60; | ||
const hrs = Math.round(millis / (3600 * 1000)); | ||
const sec = Math.floor(millis / 1000) % 60; | ||
const min = Math.floor(millis / (60 * 1000)) % 60; | ||
const hrs = Math.floor(millis / (3600 * 1000)); | ||
// <1 hr | ||
if (hrs === 0) | ||
if (hrs === 0) { | ||
// <1 min | ||
if (min === 0) | ||
return `${sec} sec`; | ||
return `${min}m${sec}s`; | ||
} | ||
// >= 1hr | ||
@@ -35,0 +36,0 @@ return `${hrs}h${min}m${sec}s`; |
@@ -27,11 +27,12 @@ "use strict"; | ||
return `${(millis / 1000).toFixed(3)} sec`; | ||
// <1 min | ||
if (millis < 60 * 1000) | ||
return `${Math.round(millis / 1000)} sec`; | ||
const sec = Math.round(millis / 1000) % 60; | ||
const min = Math.round(millis / (60 * 1000)) % 60; | ||
const hrs = Math.round(millis / (3600 * 1000)); | ||
const sec = Math.floor(millis / 1000) % 60; | ||
const min = Math.floor(millis / (60 * 1000)) % 60; | ||
const hrs = Math.floor(millis / (3600 * 1000)); | ||
// <1 hr | ||
if (hrs === 0) | ||
if (hrs === 0) { | ||
// <1 min | ||
if (min === 0) | ||
return `${sec} sec`; | ||
return `${min}m${sec}s`; | ||
} | ||
// >= 1hr | ||
@@ -38,0 +39,0 @@ return `${hrs}h${min}m${sec}s`; |
@@ -42,3 +42,3 @@ { | ||
}, | ||
"version": "1.6.6", | ||
"version": "1.6.7", | ||
"description": "Date/time related API, based on DayJS", | ||
@@ -45,0 +45,0 @@ "keywords": [ |
@@ -26,14 +26,16 @@ export const TS_2018_06_21 = 1529539200 | ||
// <1 min | ||
if (millis < 60 * 1000) return `${Math.round(millis / 1000)} sec` | ||
const sec = Math.floor(millis / 1000) % 60 | ||
const min = Math.floor(millis / (60 * 1000)) % 60 | ||
const hrs = Math.floor(millis / (3600 * 1000)) | ||
const sec = Math.round(millis / 1000) % 60 | ||
const min = Math.round(millis / (60 * 1000)) % 60 | ||
const hrs = Math.round(millis / (3600 * 1000)) | ||
// <1 hr | ||
if (hrs === 0) return `${min}m${sec}s` | ||
if (hrs === 0) { | ||
// <1 min | ||
if (min === 0) return `${sec} sec` | ||
return `${min}m${sec}s` | ||
} | ||
// >= 1hr | ||
return `${hrs}h${min}m${sec}s` | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39287
642