@docaohuynh/ielts-api-utils 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Compares two date strings in ISO format or null values
3
+ * @param date1 - First date string in ISO format or null
4
+ * @param date2 - Second date string in ISO format or null
5
+ * @returns -1 if date1 is earlier than date2, 0 if equal, 1 if date1 is later than date2
6
+ * If either date is null, treats it as earlier than any valid date
7
+ */
8
+ export declare function compareDates(date1: string | null, date2: string | null): number;
9
+ /**
10
+ * Checks if date1 is earlier than date2
11
+ * @param date1 - First date string in ISO format or null
12
+ * @param date2 - Second date string in ISO format or null
13
+ * @returns true if date1 is earlier than date2, false otherwise
14
+ */
15
+ export declare function isBefore(date1: string | null, date2: string | null): boolean;
16
+ /**
17
+ * Checks if date1 is later than date2
18
+ * @param date1 - First date string in ISO format or null
19
+ * @param date2 - Second date string in ISO format or null
20
+ * @returns true if date1 is later than date2, false otherwise
21
+ */
22
+ export declare function isAfter(date1: string | null, date2: string | null): boolean;
23
+ /**
24
+ * Checks if two dates are equal
25
+ * @param date1 - First date string in ISO format or null
26
+ * @param date2 - Second date string in ISO format or null
27
+ * @returns true if dates are equal, false otherwise
28
+ */
29
+ export declare function isEqual(date1: string | null, date2: string | null): boolean;
@@ -0,0 +1,2 @@
1
+ export * from './date-compare.util';
2
+ export * from './year-range.util';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Gets the start of the year (first millisecond of January 1st) for a given date.
3
+ * If no date is provided, uses the current date.
4
+ * @param dateOrTimestamp - A Date object, timestamp, or ISO string representing the date. If null/undefined, uses current date.
5
+ * @returns A Date object representing the start of the year
6
+ */
7
+ export declare function getStartOfYear(dateOrTimestamp?: Date | number | string | null): Date;
8
+ /**
9
+ * Gets the end of the year (last millisecond of December 31st) for a given date.
10
+ * If no date is provided, uses the current date.
11
+ * @param dateOrTimestamp - A Date object, timestamp, or ISO string representing the date. If null/undefined, uses current date.
12
+ * @returns A Date object representing the end of the year
13
+ */
14
+ export declare function getEndOfYear(dateOrTimestamp?: Date | number | string | null): Date;
@@ -6,3 +6,4 @@ export * from './list';
6
6
  export * from './time';
7
7
  export * from './request';
8
8
  export * from './slug';
9
+ export * from './date';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docaohuynh/ielts-api-utils",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "Utilities for IELTS API",
5
5
  "module": "index.ts",
6
6
  "main": "dist/index.js",
@@ -13,15 +13,15 @@
13
13
  "devDependencies": {
14
14
  "@types/bun": "latest",
15
15
  "mockdate": "^3.0.5",
16
- "vitest": "^3.2.4"
16
+ "vitest": "^4.0.18"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "typescript": "^5.9.2"
20
20
  },
21
21
  "dependencies": {
22
- "@sindresorhus/slugify": "^2.2.1",
22
+ "@sindresorhus/slugify": "^3.0.0",
23
23
  "@types/luxon": "^3.7.1",
24
- "luxon": "^3.7.1",
25
- "transliteration": "^2.3.5"
24
+ "luxon": "^3.7.2",
25
+ "transliteration": "^2.6.1"
26
26
  }
27
27
  }