@@ -94,26 +94,26 @@ export interface DateLibOptions
9494}
9595
9696/**
97- * A wrapper class around [date-fns](http://date-fns.org) sharing the same
98- * options .
97+ * A wrapper class around [date-fns](http://date-fns.org) that provides utility
98+ * methods for date manipulation and formatting .
9999 *
100100 * @since 9.2.0
101101 * @example
102102 * const dateLib = new DateLib({ locale: es });
103103 * const newDate = dateLib.addDays(new Date(), 5);
104104 */
105105export class DateLib {
106- /** The options for the date library. */
106+ /** The options for configuring the date library. */
107107 readonly options : DateLibOptions ;
108108
109- /** Overrides for the date library functions. */
109+ /** Overrides for the default date library functions. */
110110 readonly overrides ?: Partial < typeof DateLib . prototype > ;
111111
112112 /**
113- * Creates an instance of DateLib.
113+ * Creates an instance of ` DateLib` .
114114 *
115- * @param options The options for the date library.
116- * @param overrides Overrides for the date library functions.
115+ * @param options Configuration options for the date library.
116+ * @param overrides Custom overrides for the date library functions.
117117 */
118118 constructor (
119119 options ?: DateLibOptions ,
@@ -124,9 +124,11 @@ export class DateLib {
124124 }
125125
126126 /**
127- * Generate digit map dynamically using Intl.NumberFormat.
127+ * Generates a mapping of Arabic digits (0-9) to the target numbering system
128+ * digits.
128129 *
129130 * @since 9.5.0
131+ * @returns A record mapping Arabic digits to the target numerals.
130132 */
131133 private getDigitMap ( ) : Record < string , string > {
132134 const { numerals = "latn" } = this . options ;
@@ -146,21 +148,23 @@ export class DateLib {
146148 }
147149
148150 /**
149- * Replace Arabic digits with the target numbering system digits.
151+ * Replaces Arabic digits in a string with the target numbering system digits.
150152 *
151153 * @since 9.5.0
154+ * @param input The string containing Arabic digits.
155+ * @returns The string with digits replaced.
152156 */
153157 private replaceDigits ( input : string ) : string {
154158 const digitMap = this . getDigitMap ( ) ;
155159 return input . replace ( / \d / g, ( digit ) => digitMap [ digit ] || digit ) ;
156160 }
157161
158162 /**
159- * Format number using the custom numbering system.
163+ * Formats a number using the configured numbering system.
160164 *
161165 * @since 9.5.0
162166 * @param value The number to format.
163- * @returns The formatted number.
167+ * @returns The formatted number as a string .
164168 */
165169 formatNumber ( value : number | string ) : string {
166170 return this . replaceDigits ( value . toString ( ) ) ;
@@ -174,10 +178,10 @@ export class DateLib {
174178 Date : typeof Date = Date ;
175179
176180 /**
177- * Creates a new date object to the today's date.
181+ * Creates a new `Date` object representing today's date.
178182 *
179183 * @since 9.5.0
180- * @returns The new date object.
184+ * @returns A `Date` object for today's date .
181185 */
182186 today = ( ) : Date => {
183187 if ( this . overrides ?. today ) {
@@ -190,13 +194,13 @@ export class DateLib {
190194 } ;
191195
192196 /**
193- * Creates a new date object with the specified year, month and date .
197+ * Creates a new `Date` object with the specified year, month, and day .
194198 *
195199 * @since 9.5.0
196200 * @param year The year.
197201 * @param monthIndex The month (0-11).
198202 * @param date The day of the month.
199- * @returns The new date object.
203+ * @returns A new `Date` object.
200204 */
201205 newDate = ( year : number , monthIndex : number , date : number ) : Date => {
202206 if ( this . overrides ?. newDate ) {
0 commit comments