@episodehunter/utils
Advanced tools
Comparing version 1.0.1 to 1.0.3
@@ -0,2 +1,4 @@ | ||
export * from './arrary'; | ||
export * from './episode'; | ||
export * from './gql'; | ||
export * from './time'; |
@@ -6,4 +6,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./arrary")); | ||
__export(require("./episode")); | ||
__export(require("./gql")); | ||
__export(require("./time")); | ||
//# sourceMappingURL=index.js.map |
export declare function unixTimestamp(): number; | ||
export declare function createDateString(date: Date): string; | ||
export declare function daysAgoOnFormatYYYYMMDD(n: number, now?: Date): string; |
@@ -7,2 +7,14 @@ "use strict"; | ||
exports.unixTimestamp = unixTimestamp; | ||
function createDateString(date) { | ||
const year = String(date.getFullYear()); | ||
const month = String(date.getMonth() + 1).padStart(2, '0'); | ||
const day = String(date.getDate()).padStart(2, '0'); | ||
return `${year}-${month}-${day}`; | ||
} | ||
exports.createDateString = createDateString; | ||
function daysAgoOnFormatYYYYMMDD(n, now = new Date()) { | ||
now.setDate(now.getDate() - n); | ||
return createDateString(now); | ||
} | ||
exports.daysAgoOnFormatYYYYMMDD = daysAgoOnFormatYYYYMMDD; | ||
//# sourceMappingURL=time.js.map |
{ | ||
"name": "@episodehunter/utils", | ||
"version": "1.0.1", | ||
"version": "1.0.3", | ||
"description": "Util functions for episodehunter", | ||
@@ -8,3 +8,4 @@ "main": "dist/index.js", | ||
"build": "tsc", | ||
"prepare": "npm run build" | ||
"prepare": "npm run build", | ||
"test": "jest" | ||
}, | ||
@@ -26,3 +27,6 @@ "repository": { | ||
"devDependencies": { | ||
"typescript": "^3.5.3" | ||
"@types/jest": "24.0.17", | ||
"jest": "24.9.0", | ||
"ts-jest": "24.0.2", | ||
"typescript": "3.5.3" | ||
}, | ||
@@ -32,3 +36,3 @@ "prettier": { | ||
}, | ||
"gitHead": "bb6c459cb823c856d674ae25c036647d07f2252c" | ||
"gitHead": "9f7ed2a30ffb94331c63af6b8af9d0a4fce2b069" | ||
} |
@@ -0,2 +1,4 @@ | ||
export * from './arrary'; | ||
export * from './episode'; | ||
export * from './gql'; | ||
export * from './time'; |
export function unixTimestamp() { | ||
return (Date.now() / 1000) | 0; | ||
} | ||
export function createDateString(date: Date) { | ||
const year = String(date.getFullYear()); | ||
const month = String(date.getMonth() + 1).padStart(2, '0'); | ||
const day = String(date.getDate()).padStart(2, '0'); | ||
return `${year}-${month}-${day}`; | ||
} | ||
export function daysAgoOnFormatYYYYMMDD(n: number, now = new Date()) { | ||
now.setDate(now.getDate() - n); | ||
return createDateString(now); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
52623
39
676
4
1