fenextjs-date
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -14,2 +14,6 @@ export interface FenextjsDateFormatOptions extends Intl.DateTimeFormatOptions { | ||
export type FenextjsDateConstructor = FenextjsDateValue | FenextjsDateProps; | ||
export declare const FenextjsDateCompare: readonly ["Date", "FullYear", "Hours", "Milliseconds", "Minutes", "Month", "Seconds"]; | ||
export type FenextjsDateCompareType = (typeof FenextjsDateCompare)[number]; | ||
export declare const FenextjsDateCompareSymbol: string[]; | ||
export type FenextjsDateCompareSymbolType = (typeof FenextjsDateCompareSymbol)[number]; | ||
export declare class FenextjsDate { | ||
@@ -44,2 +48,14 @@ date: Date; | ||
}): boolean; | ||
onCompareDate({ date, dateCompare, compare, compareSymbol, }: { | ||
date?: Date; | ||
dateCompare: Date; | ||
compare: { | ||
[id in FenextjsDateCompareType]?: boolean; | ||
}; | ||
compareSymbol: { | ||
[id in FenextjsDateCompareSymbolType]?: boolean; | ||
}; | ||
}): { | ||
[x: string]: boolean | undefined; | ||
}; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FenextjsDate = void 0; | ||
exports.FenextjsDate = exports.FenextjsDateCompareSymbol = exports.FenextjsDateCompare = void 0; | ||
exports.FenextjsDateCompare = [ | ||
"Date", | ||
"FullYear", | ||
"Hours", | ||
"Milliseconds", | ||
"Minutes", | ||
"Month", | ||
"Seconds", | ||
]; | ||
exports.FenextjsDateCompareSymbol = ["==", "!=", ">", ">=", "<", "<="]; | ||
class FenextjsDate { | ||
@@ -130,4 +140,23 @@ date; | ||
} | ||
onCompareDate({ date, dateCompare, compare, compareSymbol, }) { | ||
const d = new Date(date ?? this.date); | ||
const compareValue = {}; | ||
exports.FenextjsDateCompare.forEach((e) => { | ||
const compareKey = e; | ||
if (compare[compareKey] !== true) { | ||
const f = `set${compareKey}`; | ||
d[f](0); | ||
dateCompare[f](0); | ||
} | ||
}); | ||
exports.FenextjsDateCompareSymbol.forEach((b) => { | ||
const compareKeySymbol = b; | ||
if (compareSymbol[compareKeySymbol] === true) { | ||
compareValue[compareKeySymbol] = eval(`${d.getTime()} ${compareKeySymbol} ${dateCompare.getTime()}`); | ||
} | ||
}); | ||
return compareValue; | ||
} | ||
} | ||
exports.FenextjsDate = FenextjsDate; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "fenextjs-date", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./cjs/index.js", |
Sorry, the diff of this file is not supported yet
14985
219