@waiting/shared-core
Advanced tools
Comparing version 6.0.1 to 6.0.2
@@ -6,2 +6,10 @@ # Change Log | ||
## 6.0.2 (2021-03-17) | ||
**Note:** Version bump only for package @waiting/shared-core | ||
## 6.0.1 (2021-03-12) | ||
@@ -8,0 +16,0 @@ |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* @version 6.0.0 | ||
* @version 6.0.1 | ||
* @author waiting | ||
@@ -252,2 +252,28 @@ * @license MIT | ||
/** | ||
* Generate ISO 8601 string with timezone offset, | ||
* like '2021-03-17T19:47:28+08:00' | ||
* | ||
* @link https://stackoverflow.com/a/17415677 | ||
*/ | ||
function genISOString(date) { | ||
const dd = date ? date : new Date(); | ||
const tzo = -dd.getTimezoneOffset(); | ||
const dif = tzo >= 0 ? '+' : '-'; | ||
const ret = dd.getFullYear().toString() | ||
+ '-' + pad(dd.getMonth() + 1) | ||
+ '-' + pad(dd.getDate()) | ||
+ 'T' + pad(dd.getHours()) | ||
+ ':' + pad(dd.getMinutes()) | ||
+ ':' + pad(dd.getSeconds()) | ||
+ '.' + dd.getMilliseconds().toString() | ||
+ dif + pad(tzo / 60) | ||
+ ':' + pad(tzo % 60); | ||
return ret; | ||
} | ||
function pad(num) { | ||
const norm = Math.floor(Math.abs(num)); | ||
return (norm < 10 ? '0' : '') + norm.toString(); | ||
} | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
@@ -361,2 +387,3 @@ /** | ||
exports.fileExists = fileExists; | ||
exports.genISOString = genISOString; | ||
exports.genRandomInt = genRandomInt; | ||
@@ -363,0 +390,0 @@ exports.isDirExists = isDirExists; |
export * from './asset'; | ||
export * from './consts'; | ||
export * from './date'; | ||
export * from './file'; | ||
@@ -4,0 +5,0 @@ export * from './utils'; |
export * from './asset'; | ||
export * from './consts'; | ||
export * from './date'; | ||
export * from './file'; | ||
@@ -4,0 +5,0 @@ export * from './utils'; |
{ | ||
"name": "@waiting/shared-core", | ||
"author": "waiting", | ||
"version": "6.0.1", | ||
"version": "6.0.2", | ||
"description": "node core function re export with Promise or Observable", | ||
@@ -26,3 +26,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@waiting/shared-types": "^6.0.1", | ||
"@waiting/shared-types": "^6.0.2", | ||
"rxjs": "6" | ||
@@ -49,2 +49,3 @@ }, | ||
"test:browser": "cd .config && npm run browser && cd ..", | ||
"test:local": "cross-env TS_NODE_PROJECT=test/tsconfig.json ../../node_modules/.bin/mocha --parallel=false", | ||
"tsc": "tsc -p tsconfig.json", | ||
@@ -79,3 +80,3 @@ "tsc:w": "tsc -p tsconfig.json -w" | ||
}, | ||
"gitHead": "a0419e674fa4a527579674e6920a1e7db17da4df" | ||
"gitHead": "6ddccdcfd537779ab98a477f2f907de329262164" | ||
} |
Sorry, the diff of this file is not supported yet
66109
858
Updated@waiting/shared-types@^6.0.2