@byloth/core
Advanced tools
Comparing version 1.5.2 to 1.5.3
@@ -1037,6 +1037,6 @@ var S = Object.defineProperty; | ||
function B(s, e, t = 864e5) { | ||
return Math.floor((e.getTime() - s.getTime()) / t); | ||
return s = new Date(s), e = new Date(e), Math.floor((e.getTime() - s.getTime()) / t); | ||
} | ||
function K(s, e, t = 864e5) { | ||
return new c(function* () { | ||
return s = new Date(s), e = new Date(e), new c(function* () { | ||
const n = e.getTime(); | ||
@@ -1049,3 +1049,3 @@ let r = s.getTime(); | ||
function H(s, e = 864e5) { | ||
return new Date(Math.floor(s.getTime() / e) * e); | ||
return s = new Date(s), new Date(Math.floor(s.getTime() / e) * e); | ||
} | ||
@@ -1151,3 +1151,3 @@ function W(s, e = "text/javascript") { | ||
} | ||
const re = "1.5.2"; | ||
const re = "1.5.3"; | ||
export { | ||
@@ -1154,0 +1154,0 @@ y as AggregatedAsyncIterator, |
{ | ||
"name": "@byloth/core", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"description": "An unopinionated collection of useful functions and classes that I use widely in all my projects. 🔧", | ||
@@ -51,2 +51,3 @@ "keywords": [ | ||
"@byloth/eslint-config-typescript": "^2.8.1", | ||
"@types/node": "^20.14.11", | ||
"@typescript-eslint/eslint-plugin": "^7.16.1", | ||
@@ -53,0 +54,0 @@ "@typescript-eslint/parser": "^7.16.1", |
@@ -1,2 +0,2 @@ | ||
export const VERSION = "1.5.2"; | ||
export const VERSION = "1.5.3"; | ||
@@ -3,0 +3,0 @@ export type { Constructor, Interval, Timeout } from "./core/types.js"; |
@@ -15,9 +15,15 @@ import { SmartIterator } from "../models/index.js"; | ||
export function dateDifference(start: Date, end: Date, unit = DateUnit.Day): number | ||
export function dateDifference(start: string | Date, end: string | Date, unit = DateUnit.Day): number | ||
{ | ||
start = new Date(start); | ||
end = new Date(end); | ||
return Math.floor((end.getTime() - start.getTime()) / unit); | ||
} | ||
export function dateRange(start: Date, end: Date, offset = DateUnit.Day): SmartIterator<Date> | ||
export function dateRange(start: string | Date, end: string | Date, offset = DateUnit.Day): SmartIterator<Date> | ||
{ | ||
start = new Date(start); | ||
end = new Date(end); | ||
return new SmartIterator<Date>(function* () | ||
@@ -37,5 +43,7 @@ { | ||
export function dateRound(date: Date, unit = DateUnit.Day): Date | ||
export function dateRound(date: string | Date, unit = DateUnit.Day): Date | ||
{ | ||
date = new Date(date); | ||
return new Date(Math.floor(date.getTime() / unit) * unit); | ||
} |
Sorry, the diff of this file is not supported yet
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
322935
3231
8