fenextjs-date
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -10,2 +10,3 @@ export interface FenextjsDateFormatOptions extends Intl.DateTimeFormatOptions { | ||
formats?: FenextjsDateFormats<F>; | ||
onCallback?: (date: FenextjsDate<F>) => void; | ||
} | ||
@@ -16,2 +17,3 @@ export type FenextjsDateValue = Date | number | string; | ||
private formats; | ||
private onCallback; | ||
private DateByMonth; | ||
@@ -18,0 +20,0 @@ private DateByCalendar; |
@@ -6,2 +6,3 @@ "use strict"; | ||
formats = {}; | ||
onCallback = undefined; | ||
DateByMonth = []; | ||
@@ -23,2 +24,3 @@ DateByCalendar = []; | ||
this.formats = options?.formats ?? {}; | ||
this.onCallback = options?.onCallback; | ||
} | ||
@@ -28,23 +30,31 @@ } | ||
this.setTime(this.getTime() + time); | ||
this.onCallback?.(this); | ||
} | ||
addMilliseconds(milliseconds) { | ||
this.setMilliseconds(this.getMilliseconds() + milliseconds); | ||
this.onCallback?.(this); | ||
} | ||
addSeconds(seconds) { | ||
this.setSeconds(this.getSeconds() + seconds); | ||
this.onCallback?.(this); | ||
} | ||
addMinutes(minutes) { | ||
this.setMinutes(this.getMinutes() + minutes); | ||
this.onCallback?.(this); | ||
} | ||
addHours(hours) { | ||
this.setHours(this.getHours() + hours); | ||
this.onCallback?.(this); | ||
} | ||
addDate(date) { | ||
this.setDate(this.getDate() + date); | ||
this.onCallback?.(this); | ||
} | ||
addMonth(month) { | ||
this.setMonth(this.getMonth() + month); | ||
this.onCallback?.(this); | ||
} | ||
addYear(year) { | ||
this.setFullYear(this.getFullYear() + year); | ||
this.onCallback?.(this); | ||
} | ||
@@ -51,0 +61,0 @@ onFormat(options, date) { |
{ | ||
"name": "fenextjs-date", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./cjs/index.js", |
Sorry, the diff of this file is not supported yet
11194
152