@org-quicko/core 2.0.4 → 2.0.6

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.
Files changed (49) hide show
  1. package/README.md +56 -8
  2. package/dist/browser/beans/BaseObject.js.map +1 -1
  3. package/dist/browser/exceptions/BadRequestException.js.map +1 -1
  4. package/dist/browser/exceptions/BaseException.js.map +1 -1
  5. package/dist/browser/exceptions/ClientException.js.map +1 -1
  6. package/dist/browser/exceptions/ConverterException.js.map +1 -1
  7. package/dist/browser/exceptions/ForbiddenAccessException.js.map +1 -1
  8. package/dist/browser/exceptions/HTTPException.js.map +1 -1
  9. package/dist/browser/exceptions/IllegalArgumentException.js.map +1 -1
  10. package/dist/browser/exceptions/UnauthorizedException.js.map +1 -1
  11. package/dist/browser/types/JSONObject.js.map +1 -1
  12. package/dist/browser/types/LoggingLevel.js.map +1 -1
  13. package/dist/browser/types/SortOrder.js.map +1 -1
  14. package/dist/browser/utils/date/DateUtil.js +32 -25
  15. package/dist/browser/utils/date/DateUtil.js.map +1 -1
  16. package/dist/cjs/beans/BaseObject.cjs.map +1 -1
  17. package/dist/cjs/exceptions/BadRequestException.cjs.map +1 -1
  18. package/dist/cjs/exceptions/BaseException.cjs.map +1 -1
  19. package/dist/cjs/exceptions/ClientException.cjs.map +1 -1
  20. package/dist/cjs/exceptions/ConverterException.cjs.map +1 -1
  21. package/dist/cjs/exceptions/ForbiddenAccessException.cjs.map +1 -1
  22. package/dist/cjs/exceptions/HTTPException.cjs.map +1 -1
  23. package/dist/cjs/exceptions/IllegalArgumentException.cjs.map +1 -1
  24. package/dist/cjs/exceptions/UnauthorizedException.cjs.map +1 -1
  25. package/dist/cjs/logger/LoggerFactory.cjs.map +1 -1
  26. package/dist/cjs/logger/format/ErrorFormat.cjs.map +1 -1
  27. package/dist/cjs/types/JSONObject.cjs.map +1 -1
  28. package/dist/cjs/types/LoggingLevel.cjs.map +1 -1
  29. package/dist/cjs/types/SortOrder.cjs.map +1 -1
  30. package/dist/cjs/utils/date/DateUtil.cjs +32 -25
  31. package/dist/cjs/utils/date/DateUtil.cjs.map +1 -1
  32. package/dist/esm/beans/BaseObject.js.map +1 -1
  33. package/dist/esm/exceptions/BadRequestException.js.map +1 -1
  34. package/dist/esm/exceptions/BaseException.js.map +1 -1
  35. package/dist/esm/exceptions/ClientException.js.map +1 -1
  36. package/dist/esm/exceptions/ConverterException.js.map +1 -1
  37. package/dist/esm/exceptions/ForbiddenAccessException.js.map +1 -1
  38. package/dist/esm/exceptions/HTTPException.js.map +1 -1
  39. package/dist/esm/exceptions/IllegalArgumentException.js.map +1 -1
  40. package/dist/esm/exceptions/UnauthorizedException.js.map +1 -1
  41. package/dist/esm/logger/LoggerFactory.js.map +1 -1
  42. package/dist/esm/logger/format/ErrorFormat.js.map +1 -1
  43. package/dist/esm/types/JSONObject.js.map +1 -1
  44. package/dist/esm/types/LoggingLevel.js.map +1 -1
  45. package/dist/esm/types/SortOrder.js.map +1 -1
  46. package/dist/esm/utils/date/DateUtil.js +32 -25
  47. package/dist/esm/utils/date/DateUtil.js.map +1 -1
  48. package/dist/types/src/utils/date/DateUtil.d.ts +39 -17
  49. package/package.json +123 -140
@@ -1 +1 @@
1
- {"version":3,"file":"DateUtil.js","sources":["../../../../src/utils/date/DateUtil.ts"],"sourcesContent":["import { TZDate } from '@date-fns/tz';\r\nimport { add, compareAsc, differenceInCalendarDays, differenceInCalendarMonths, differenceInCalendarYears, differenceInHours, differenceInSeconds, Duration, endOfDay, format, isLeapYear, isValid, parse, startOfDay } from 'date-fns';\r\nimport { IllegalArgumentException } from '../../exceptions';\r\n\r\n/**\r\n * Utility class for date and time operations. Provides methods for parsing,\r\n * formatting, and performing calculations with dates and times.\r\n */\r\nexport class DateUtil {\r\n\r\n static readonly ISO_8601_FORMAT = \"yyyy-MM-dd'T'HH:mm:ss.SSSxxx\"\r\n\r\n /**\r\n * Gets the current date and time in the specified time zone.\r\n * @param timeZone The IANA time zone identifier.\r\n * @returns Current date and time in the specified time zone.\r\n */\r\n static now(timeZone: string): Date {\r\n return new TZDate(new Date(), timeZone);\r\n }\r\n\r\n /**\r\n * Gets the current time in milliseconds since the Unix epoch.\r\n * @returns Current time in milliseconds.\r\n */\r\n static nowInMillis(): number {\r\n return Date.now();\r\n }\r\n\r\n /**\r\n * Parses a date string into a Date object.\r\n * @param dateString The date string to parse.\r\n * @param dateFormat The format of the date string (default: ISO_8601_FORMAT).\r\n * @param timeZone The IANA time zone identifier.\r\n * @throws {IllegalArgumentException} If the date string is invalid.\r\n * @returns Parsed Date object.\r\n */\r\n static readDate(dateString: string, dateFormat = this.ISO_8601_FORMAT, timeZone: string): Date {\r\n const date = parse(dateString, dateFormat, TZDate.tz(timeZone));\r\n if (!isValid(date)) {\r\n throw new IllegalArgumentException('Invalid date string or date format');\r\n }\r\n return date;\r\n }\r\n\r\n /**\r\n * Formats a Date or timestamp into a string.\r\n * @param date The date or timestamp to format.\r\n * @param timeZone The IANA time zone identifier.\r\n * @param dateFormat The desired output format (default: ISO_8601_FORMAT).\r\n * @returns Formatted date string.\r\n */\r\n static printDate(date: Date, timeZone: string, dateFormat?: string): string;\r\n static printDate(date: number, timeZone: string, dateFormat?: string): string;\r\n static printDate(date: Date | number, timeZone: string, dateFormat: string = this.ISO_8601_FORMAT): string {\r\n const normalizedDate = typeof date === 'number' ? new Date(date) : date;\r\n return format(new TZDate(normalizedDate, timeZone), dateFormat);\r\n }\r\n\r\n /**\r\n * Gets the start of the day for a given date or timestamp.\r\n * @param date The date or timestamp to calculate from.\r\n * @param timeZone The IANA time zone identifier.\r\n * @returns The start of the day as a Date object.\r\n */\r\n static getStartOfDay(date: Date, timeZone: string): Date;\r\n static getStartOfDay(date: number, timeZone: string): Date;\r\n static getStartOfDay(date: Date | number, timeZone: string): Date {\r\n const normalizedDate = typeof date === 'number' ? new Date(date) : date;\r\n return startOfDay(new TZDate(normalizedDate, timeZone));\r\n }\r\n\r\n /**\r\n * Gets the end of the day for a given date or timestamp.\r\n * @param date The date or timestamp to calculate from.\r\n * @param timeZone The IANA time zone identifier.\r\n * @returns The end of the day as a Date object.\r\n */\r\n static getEndOfDay(date: Date, timeZone: string): Date;\r\n static getEndOfDay(date: number, timeZone: string): Date;\r\n static getEndOfDay(date: Date | number, timeZone: string): Date {\r\n const normalizedDate = typeof date === 'number' ? new Date(date) : date;\r\n return endOfDay(new TZDate(normalizedDate, timeZone));\r\n }\r\n\r\n /**\r\n * Checks if a date string is valid according to the specified format.\r\n * @param dateString The date string to validate.\r\n * @param dateFormat Optional date format (default: ISO_8601_FORMAT).\r\n * @returns True if the date is valid, false otherwise.\r\n */\r\n static isValidDate(dateString: string, dateFormat?: string): boolean {\r\n try {\r\n DateUtil.readDate(dateString, dateFormat, \"UTC\");\r\n return true;\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n } catch (error) {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Calculates the absolute number of days between two dates or timestamps.\r\n * @param firstDate The first date or timestamp.\r\n * @param secondDate The second date or timestamp.\r\n * @returns Number of days between the two dates.\r\n */\r\n static daysInBetween(firstDate: Date, secondDate: Date): number;\r\n static daysInBetween(firstDate: number, secondDate: number): number;\r\n static daysInBetween(firstDate: Date | number, secondDate: Date | number): number {\r\n const first = typeof firstDate === 'number' ? new Date(firstDate) : firstDate;\r\n const second = typeof secondDate === 'number' ? new Date(secondDate) : secondDate;\r\n return Math.abs(differenceInCalendarDays(first, second));\r\n }\r\n\r\n /**\r\n * Calculates the absolute number of months between two dates or timestamps.\r\n * @param firstDate The first date or timestamp.\r\n * @param secondDate The second date or timestamp.\r\n * @returns The number of months between the two dates.\r\n */\r\n static monthsInBetween(firstDate: Date, secondDate: Date): number;\r\n static monthsInBetween(firstDate: number, secondDate: number): number;\r\n static monthsInBetween(firstDate: Date | number, secondDate: Date | number): number {\r\n const first = typeof firstDate === 'number' ? new Date(firstDate) : firstDate;\r\n const second = typeof secondDate === 'number' ? new Date(secondDate) : secondDate;\r\n return Math.abs(differenceInCalendarMonths(first, second));\r\n }\r\n\r\n /**\r\n * Calculates the absolute number of years between two dates or timestamps.\r\n * @param firstDate The first date or timestamp.\r\n * @param secondDate The second date or timestamp.\r\n * @returns The number of years between the two dates.\r\n */\r\n static yearsInBetween(firstDate: Date, secondDate: Date): number;\r\n static yearsInBetween(firstDate: number, secondDate: number): number;\r\n static yearsInBetween(firstDate: Date | number, secondDate: Date | number): number {\r\n const first = typeof firstDate === 'number' ? new Date(firstDate) : firstDate;\r\n const second = typeof secondDate === 'number' ? new Date(secondDate) : secondDate;\r\n return Math.abs(differenceInCalendarYears(first, second));\r\n }\r\n\r\n /**\r\n * Calculates the absolute number of hours between two dates or timestamps.\r\n * @param firstDate The first date or timestamp.\r\n * @param secondDate The second date or timestamp.\r\n * @returns The number of hours between the two dates.\r\n */\r\n static hoursInBetween(firstDate: Date, secondDate: Date): number;\r\n static hoursInBetween(firstDate: number, secondDate: number): number;\r\n static hoursInBetween(firstDate: Date | number, secondDate: Date | number): number {\r\n const first = typeof firstDate === 'number' ? new Date(firstDate) : firstDate;\r\n const second = typeof secondDate === 'number' ? new Date(secondDate) : secondDate;\r\n return Math.abs(differenceInHours(first, second));\r\n }\r\n\r\n /**\r\n * Calculates the absolute number of seconds between two dates or timestamps.\r\n * @param firstDate The first date or timestamp.\r\n * @param secondDate The second date or timestamp.\r\n * @returns The number of seconds between the two dates.\r\n */\r\n static secondsInBetween(firstDate: Date, secondDate: Date): number;\r\n static secondsInBetween(firstDate: number, secondDate: number): number;\r\n static secondsInBetween(firstDate: Date | number, secondDate: Date | number): number {\r\n const first = typeof firstDate === 'number' ? new Date(firstDate) : firstDate;\r\n const second = typeof secondDate === 'number' ? new Date(secondDate) : secondDate;\r\n return Math.abs(differenceInSeconds(first, second));\r\n }\r\n\r\n /**\r\n * Compares two dates or timestamps.\r\n * @param firstDate The first date or timestamp.\r\n * @param secondDate The second date or timestamp.\r\n * @returns `-1` if the first date is earlier, `1` if it is later, or `0` if the two dates are equal.\r\n */\r\n static compareDates(firstDate: Date, secondDate: Date): -1 | 0 | 1;\r\n static compareDates(firstDate: number, secondDate: number): -1 | 0 | 1;\r\n static compareDates(firstDate: Date | number, secondDate: Date | number): -1 | 0 | 1 {\r\n const first = typeof firstDate === 'number' ? new Date(firstDate) : firstDate;\r\n const second = typeof secondDate === 'number' ? new Date(secondDate) : secondDate;\r\n\r\n return compareAsc(first, second) as -1 | 0 | 1;\r\n }\r\n\r\n /**\r\n * Adds a duration (e.g., days, months, years) to a given date or timestamp.\r\n * @param date The base date or timestamp to which the duration will be added.\r\n * @param duration An object specifying the duration (e.g., `{ days: 1, months: 2 }`).\r\n * @returns A new Date object with the duration added.\r\n */\r\n static addDuration(date: Date, duration: Duration): Date;\r\n static addDuration(date: number, duration: Duration): Date;\r\n static addDuration(date: Date | number, duration: Duration): Date {\r\n const normalizedDate = typeof date === 'number' ? new Date(date) : date;\r\n return add(normalizedDate, duration);\r\n }\r\n\r\n /**\r\n * Determines whether a given year is a leap year.\r\n * @param year The year to check.\r\n * @returns `true` if the year is a leap year, otherwise `false`.\r\n */\r\n static isLeapYear(year: number): boolean {\r\n return isLeapYear(DateUtil.readDate(year.toString(), 'yyyy', \"UTC\"));\r\n }\r\n\r\n\r\n /**\r\n * Converts a timestamp (in milliseconds) to a Date object.\r\n * @param milliseconds The timestamp in milliseconds since the Unix epoch.\r\n * @returns A Date object representing the provided timestamp.\r\n */\r\n static fromMillis(milliseconds: number): Date {\r\n return new Date(milliseconds);\r\n }\r\n\r\n /**\r\n * Converts a Date object to a timestamp (in milliseconds).\r\n * @param date The Date object to convert.\r\n * @returns The timestamp in milliseconds since the Unix epoch.\r\n */\r\n static toMillis(date: Date): number {\r\n return date.getTime();\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;AAIA;;;AAGG;MACU,QAAQ,CAAA;aAED,IAAA,CAAA,eAAe,GAAG,8BAA8B,CAAA;AAEhE;;;;AAIG;IACH,OAAO,GAAG,CAAC,QAAgB,EA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D,QAAA,MAAM,cAAc,GAAG,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI;AACvE,QAAA,OAAO,GAAG,CAAC,cAAc,EAAE,QAAQ,CAAC;IACxC;AAEA;;;;AAIG;IACH,OAAO,UAAU,CAAC,IAAY,EAAA;AAC1B,QAAA,OAAO,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACxE;AAGA;;;;AAIG;IACH,OAAO,UAAU,CAAC,YAAoB,EAAA;AAClC,QAAA,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC;IACjC;AAEA;;;;AAIG;IACH,OAAO,QAAQ,CAAC,IAAU,EAAA;AACtB,QAAA,OAAO,IAAI,CAAC,OAAO,EAAE;IACzB;;;;;"}
1
+ {"version":3,"file":"DateUtil.js","sources":["../../../../src/utils/date/DateUtil.ts"],"sourcesContent":["import { TZDate } from '@date-fns/tz';\nimport { add, compareAsc, differenceInCalendarDays, differenceInCalendarMonths, differenceInCalendarYears, differenceInHours, differenceInSeconds, Duration, endOfDay, format, isLeapYear, isValid, parse, startOfDay } from 'date-fns';\nimport { IllegalArgumentException } from '../../exceptions';\n\n/**\n * Utility class for date and time operations. Provides methods for parsing,\n * formatting, and performing calculations with dates and times.\n */\nexport class DateUtil {\n\n static readonly ISO_8601_FORMAT = \"yyyy-MM-dd'T'HH:mm:ss.SSSxxx\"\n static readonly TIMEZONE = \"UTC\"\n\n /**\n * Gets the current date and time in the specified time zone.\n * @param timeZone The IANA time zone identifier.\n * @returns Current date and time in the specified time zone.\n */\n static now(timeZone: string): Date {\n return new TZDate(new Date(), timeZone);\n }\n\n /**\n * Gets the current time in milliseconds since the Unix epoch.\n * @returns Current time in milliseconds.\n */\n static nowInMillis(): number {\n return Date.now();\n }\n\n /**\n * Parses a date string into a Date object.\n * @param dateString The date string to parse.\n * @param dateFormat The format of the date string (default: ISO_8601_FORMAT).\n * @param timeZone The IANA time zone identifier.\n * @throws {IllegalArgumentException} If the date string is invalid.\n * @returns Parsed Date object.\n */\n static readDate(dateString: string, dateFormat = this.ISO_8601_FORMAT, timeZone: string): Date {\n const date = parse(dateString, dateFormat, TZDate.tz(timeZone));\n if (!isValid(date)) {\n throw new IllegalArgumentException('Invalid date string or date format');\n }\n return date;\n }\n\n /**\n * Formats a Date or timestamp into a string.\n * @param date The date or timestamp to format.\n * @param timeZone The IANA time zone identifier.\n * @param dateFormat The desired output format (default: ISO_8601_FORMAT).\n * @returns Formatted date string.\n */\n static printDate(date: Date, timeZone: string, dateFormat?: string): string;\n static printDate(date: number, timeZone: string, dateFormat?: string): string;\n static printDate(date: Date | number, timeZone: string, dateFormat: string = this.ISO_8601_FORMAT): string {\n const normalizedDate = this.normalizeDate(date);\n return format(new TZDate(normalizedDate, timeZone), dateFormat);\n }\n\n /**\n * Gets the start of the day for a given date or timestamp.\n * @param date The date or timestamp to calculate from.\n * @param timeZone The IANA time zone identifier.\n * @returns The start of the day as a Date object.\n */\n static getStartOfDay(date: Date, timeZone: string): Date;\n static getStartOfDay(date: number, timeZone: string): Date;\n static getStartOfDay(date: Date | number, timeZone: string): Date {\n const normalizedDate = this.normalizeDate(date);\n return startOfDay(new TZDate(normalizedDate, timeZone));\n }\n\n /**\n * Gets the end of the day for a given date or timestamp.\n * @param date The date or timestamp to calculate from.\n * @param timeZone The IANA time zone identifier.\n * @returns The end of the day as a Date object.\n */\n static getEndOfDay(date: Date, timeZone: string): Date;\n static getEndOfDay(date: number, timeZone: string): Date;\n static getEndOfDay(date: Date | number, timeZone: string): Date {\n const normalizedDate = this.normalizeDate(date);\n return endOfDay(new TZDate(normalizedDate, timeZone));\n }\n\n /**\n * Checks if a date string is valid according to the specified format.\n * @param dateString The date string to validate.\n * @param dateFormat Optional date format (default: ISO_8601_FORMAT).\n * @returns True if the date is valid, false otherwise.\n */\n static isValidDate(dateString: string, dateFormat?: string): boolean {\n try {\n DateUtil.readDate(dateString, dateFormat, \"UTC\");\n return true;\n } catch (error) {\n return false;\n }\n }\n\n /**\n * Calculates the absolute number of calendar days between two dates or timestamps.\n * Since day boundaries depend on a calendar, callers can optionally provide a time zone\n * so the same pair of instants is interpreted consistently across machines.\n *\n * @param firstDate The first date or timestamp.\n * @param secondDate The second date or timestamp.\n * @param timeZone Optional IANA time zone identifier used for calendar comparisons.\n * @returns Number of days between the two dates.\n */\n static daysInBetween(firstDate: Date, secondDate: Date, timeZone?: string): number;\n static daysInBetween(firstDate: number, secondDate: number, timeZone?: string): number;\n static daysInBetween(firstDate: Date | number, secondDate: Date | number, timeZone?: string): number {\n const first = this.normalizeDate(firstDate);\n const second = this.normalizeDate(secondDate);\n const effectiveTimeZone = timeZone || this.TIMEZONE;\n return Math.abs(\n differenceInCalendarDays(\n new TZDate(first, effectiveTimeZone),\n new TZDate(second, effectiveTimeZone),\n )\n );\n }\n\n /**\n * Calculates the absolute number of calendar months between two dates or timestamps.\n * Since month boundaries depend on a calendar, callers can optionally provide a time zone\n * so the same pair of instants is interpreted consistently across machines.\n *\n * @param firstDate The first date or timestamp.\n * @param secondDate The second date or timestamp.\n * @param timeZone Optional IANA time zone identifier used for calendar comparisons.\n * @returns The number of months between the two dates.\n */\n static monthsInBetween(firstDate: Date, secondDate: Date, timeZone?: string): number;\n static monthsInBetween(firstDate: number, secondDate: number, timeZone?: string): number;\n static monthsInBetween(firstDate: Date | number, secondDate: Date | number, timeZone?: string): number {\n const first = this.normalizeDate(firstDate);\n const second = this.normalizeDate(secondDate);\n const effectiveTimeZone = timeZone || this.TIMEZONE;\n return Math.abs(\n differenceInCalendarMonths(\n new TZDate(first, effectiveTimeZone),\n new TZDate(second, effectiveTimeZone),\n )\n );\n }\n\n /**\n * Calculates the absolute number of calendar years between two dates or timestamps.\n * Since year boundaries depend on a calendar, callers can optionally provide a time zone\n * so the same pair of instants is interpreted consistently across machines.\n *\n * @param firstDate The first date or timestamp.\n * @param secondDate The second date or timestamp.\n * @param timeZone Optional IANA time zone identifier used for calendar comparisons.\n * @returns The number of years between the two dates.\n */\n static yearsInBetween(firstDate: Date, secondDate: Date, timeZone?: string): number;\n static yearsInBetween(firstDate: number, secondDate: number, timeZone?: string): number;\n static yearsInBetween(firstDate: Date | number, secondDate: Date | number, timeZone?: string): number {\n const first = this.normalizeDate(firstDate);\n const second = this.normalizeDate(secondDate);\n const effectiveTimeZone = timeZone || this.TIMEZONE;\n return Math.abs(\n differenceInCalendarYears(\n new TZDate(first, effectiveTimeZone),\n new TZDate(second, effectiveTimeZone),\n )\n );\n }\n\n /**\n * Calculates the absolute elapsed number of hours between two dates or timestamps.\n * This is duration-based, not calendar-based, so it is independent of time zone.\n *\n * @param firstDate The first date or timestamp.\n * @param secondDate The second date or timestamp.\n * @returns The number of hours between the two dates.\n */\n static hoursInBetween(firstDate: Date, secondDate: Date): number;\n static hoursInBetween(firstDate: number, secondDate: number): number;\n static hoursInBetween(firstDate: Date | number, secondDate: Date | number): number {\n const first = this.normalizeDate(firstDate);\n const second = this.normalizeDate(secondDate);\n return Math.abs(differenceInHours(first, second));\n }\n\n /**\n * Calculates the absolute elapsed number of seconds between two dates or timestamps.\n * This is duration-based, not calendar-based, so it is independent of time zone.\n *\n * @param firstDate The first date or timestamp.\n * @param secondDate The second date or timestamp.\n * @returns The number of seconds between the two dates.\n */\n static secondsInBetween(firstDate: Date, secondDate: Date): number;\n static secondsInBetween(firstDate: number, secondDate: number): number;\n static secondsInBetween(firstDate: Date | number, secondDate: Date | number): number {\n const first = this.normalizeDate(firstDate);\n const second = this.normalizeDate(secondDate);\n return Math.abs(differenceInSeconds(first, second));\n }\n\n /**\n * Compares two dates or timestamps.\n * @param firstDate The first date or timestamp.\n * @param secondDate The second date or timestamp.\n * @returns `-1` if the first date is earlier, `1` if it is later, or `0` if the two dates are equal.\n */\n static compareDates(firstDate: Date, secondDate: Date): -1 | 0 | 1;\n static compareDates(firstDate: number, secondDate: number): -1 | 0 | 1;\n static compareDates(firstDate: Date | number, secondDate: Date | number): -1 | 0 | 1 {\n const first = this.normalizeDate(firstDate);\n const second = this.normalizeDate(secondDate);\n\n return compareAsc(first, second) as -1 | 0 | 1;\n }\n\n /**\n * Adds a duration (e.g., days, months, years) to a given date or timestamp.\n * When a time zone is provided, the duration is applied using calendar arithmetic\n * in that time zone so month-end or day-boundary business rules stay aligned locally.\n *\n * @param date The base date or timestamp to which the duration will be added.\n * @param duration An object specifying the duration (e.g., `{ days: 1, months: 2 }`).\n * @param timeZone Optional IANA time zone identifier used for calendar math.\n * @returns A new Date object with the duration added.\n */\n static addDuration(date: Date, duration: Duration, timeZone?: string): Date;\n static addDuration(date: number, duration: Duration, timeZone?: string): Date;\n static addDuration(date: Date | number, duration: Duration, timeZone?: string): Date {\n const normalizedDate = this.normalizeDate(date);\n const effectiveTimeZone = timeZone || this.TIMEZONE;\n return add(new TZDate(normalizedDate, effectiveTimeZone), duration);\n }\n\n /**\n * Determines whether a given year is a leap year.\n * @param year The year to check.\n * @returns `true` if the year is a leap year, otherwise `false`.\n */\n static isLeapYear(year: number): boolean {\n return isLeapYear(DateUtil.readDate(year.toString(), 'yyyy', \"UTC\"));\n }\n\n\n /**\n * Converts a timestamp (in milliseconds) to a Date object.\n * @param milliseconds The timestamp in milliseconds since the Unix epoch.\n * @returns A Date object representing the provided timestamp.\n */\n static fromMillis(milliseconds: number): Date {\n return new Date(milliseconds);\n }\n\n protected static normalizeDate(date: Date | number): Date {\n return typeof date === 'number' ? this.fromMillis(date) : date;\n }\n\n /**\n * Converts a Date object to a timestamp (in milliseconds).\n * @param date The Date object to convert.\n * @returns The timestamp in milliseconds since the Unix epoch.\n */\n static toMillis(date: Date): number {\n return date.getTime();\n }\n}\n"],"names":[],"mappings":";;;;AAIA;;;AAGG;MACU,QAAQ,CAAA;aAED,IAAA,CAAA,eAAe,GAAG,8BAA8B,CAAA;aAChD,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAA;AAEhC;;;;AAIG;IACH,O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AAC,IAAI,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,EAAE,QAAQ,CAAC;IACvE;AAEA;;;;AAIG;IACH,OAAO,UAAU,CAAC,IAAY,EAAA;AAC1B,QAAA,OAAO,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACxE;AAGA;;;;AAIG;IACH,OAAO,UAAU,CAAC,YAAoB,EAAA;AAClC,QAAA,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC;IACjC;IAEU,OAAO,aAAa,CAAC,IAAmB,EAAA;AAC9C,QAAA,OAAO,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI;IAClE;AAEA;;;;AAIG;IACH,OAAO,QAAQ,CAAC,IAAU,EAAA;AACtB,QAAA,OAAO,IAAI,CAAC,OAAO,EAAE;IACzB;;;;;"}
@@ -6,6 +6,7 @@ import { Duration } from 'date-fns';
6
6
  */
7
7
  declare class DateUtil {
8
8
  static readonly ISO_8601_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSxxx";
9
+ static readonly TIMEZONE = "UTC";
9
10
  /**
10
11
  * Gets the current date and time in the specified time zone.
11
12
  * @param timeZone The IANA time zone identifier.
@@ -59,31 +60,45 @@ declare class DateUtil {
59
60
  */
60
61
  static isValidDate(dateString: string, dateFormat?: string): boolean;
61
62
  /**
62
- * Calculates the absolute number of days between two dates or timestamps.
63
+ * Calculates the absolute number of calendar days between two dates or timestamps.
64
+ * Since day boundaries depend on a calendar, callers can optionally provide a time zone
65
+ * so the same pair of instants is interpreted consistently across machines.
66
+ *
63
67
  * @param firstDate The first date or timestamp.
64
68
  * @param secondDate The second date or timestamp.
69
+ * @param timeZone Optional IANA time zone identifier used for calendar comparisons.
65
70
  * @returns Number of days between the two dates.
66
71
  */
67
- static daysInBetween(firstDate: Date, secondDate: Date): number;
68
- static daysInBetween(firstDate: number, secondDate: number): number;
72
+ static daysInBetween(firstDate: Date, secondDate: Date, timeZone?: string): number;
73
+ static daysInBetween(firstDate: number, secondDate: number, timeZone?: string): number;
69
74
  /**
70
- * Calculates the absolute number of months between two dates or timestamps.
71
- * @param firstDate The first date or timestamp.
72
- * @param secondDate The second date or timestamp.
73
- * @returns The number of months between the two dates.
74
- */
75
- static monthsInBetween(firstDate: Date, secondDate: Date): number;
76
- static monthsInBetween(firstDate: number, secondDate: number): number;
75
+ * Calculates the absolute number of calendar months between two dates or timestamps.
76
+ * Since month boundaries depend on a calendar, callers can optionally provide a time zone
77
+ * so the same pair of instants is interpreted consistently across machines.
78
+ *
79
+ * @param firstDate The first date or timestamp.
80
+ * @param secondDate The second date or timestamp.
81
+ * @param timeZone Optional IANA time zone identifier used for calendar comparisons.
82
+ * @returns The number of months between the two dates.
83
+ */
84
+ static monthsInBetween(firstDate: Date, secondDate: Date, timeZone?: string): number;
85
+ static monthsInBetween(firstDate: number, secondDate: number, timeZone?: string): number;
77
86
  /**
78
- * Calculates the absolute number of years between two dates or timestamps.
87
+ * Calculates the absolute number of calendar years between two dates or timestamps.
88
+ * Since year boundaries depend on a calendar, callers can optionally provide a time zone
89
+ * so the same pair of instants is interpreted consistently across machines.
90
+ *
79
91
  * @param firstDate The first date or timestamp.
80
92
  * @param secondDate The second date or timestamp.
93
+ * @param timeZone Optional IANA time zone identifier used for calendar comparisons.
81
94
  * @returns The number of years between the two dates.
82
95
  */
83
- static yearsInBetween(firstDate: Date, secondDate: Date): number;
84
- static yearsInBetween(firstDate: number, secondDate: number): number;
96
+ static yearsInBetween(firstDate: Date, secondDate: Date, timeZone?: string): number;
97
+ static yearsInBetween(firstDate: number, secondDate: number, timeZone?: string): number;
85
98
  /**
86
- * Calculates the absolute number of hours between two dates or timestamps.
99
+ * Calculates the absolute elapsed number of hours between two dates or timestamps.
100
+ * This is duration-based, not calendar-based, so it is independent of time zone.
101
+ *
87
102
  * @param firstDate The first date or timestamp.
88
103
  * @param secondDate The second date or timestamp.
89
104
  * @returns The number of hours between the two dates.
@@ -91,7 +106,9 @@ declare class DateUtil {
91
106
  static hoursInBetween(firstDate: Date, secondDate: Date): number;
92
107
  static hoursInBetween(firstDate: number, secondDate: number): number;
93
108
  /**
94
- * Calculates the absolute number of seconds between two dates or timestamps.
109
+ * Calculates the absolute elapsed number of seconds between two dates or timestamps.
110
+ * This is duration-based, not calendar-based, so it is independent of time zone.
111
+ *
95
112
  * @param firstDate The first date or timestamp.
96
113
  * @param secondDate The second date or timestamp.
97
114
  * @returns The number of seconds between the two dates.
@@ -108,12 +125,16 @@ declare class DateUtil {
108
125
  static compareDates(firstDate: number, secondDate: number): -1 | 0 | 1;
109
126
  /**
110
127
  * Adds a duration (e.g., days, months, years) to a given date or timestamp.
128
+ * When a time zone is provided, the duration is applied using calendar arithmetic
129
+ * in that time zone so month-end or day-boundary business rules stay aligned locally.
130
+ *
111
131
  * @param date The base date or timestamp to which the duration will be added.
112
132
  * @param duration An object specifying the duration (e.g., `{ days: 1, months: 2 }`).
133
+ * @param timeZone Optional IANA time zone identifier used for calendar math.
113
134
  * @returns A new Date object with the duration added.
114
135
  */
115
- static addDuration(date: Date, duration: Duration): Date;
116
- static addDuration(date: number, duration: Duration): Date;
136
+ static addDuration(date: Date, duration: Duration, timeZone?: string): Date;
137
+ static addDuration(date: number, duration: Duration, timeZone?: string): Date;
117
138
  /**
118
139
  * Determines whether a given year is a leap year.
119
140
  * @param year The year to check.
@@ -126,6 +147,7 @@ declare class DateUtil {
126
147
  * @returns A Date object representing the provided timestamp.
127
148
  */
128
149
  static fromMillis(milliseconds: number): Date;
150
+ protected static normalizeDate(date: Date | number): Date;
129
151
  /**
130
152
  * Converts a Date object to a timestamp (in milliseconds).
131
153
  * @param date The Date object to convert.
package/package.json CHANGED
@@ -1,140 +1,123 @@
1
- {
2
- "name": "@org-quicko/core",
3
- "version": "2.0.4",
4
- "description": "A library in typescript for common entities and utilities across Quicko",
5
- "author": "Quicko",
6
- "main": "dist/cjs/build/node/index.cjs",
7
- "module": "dist/esm/build/node/index.js",
8
- "browser": "dist/browser/build/browser/index.js",
9
- "types": "dist/types/index.d.ts",
10
- "type": "module",
11
- "scripts": {
12
- "clean": "rm -rf dist && npm cache clean --force",
13
- "lint": "eslint .",
14
- "lint:fix": "eslint . --fix",
15
- "prebuild": "npm run clean && npm run lint",
16
- "build": "rollup -c",
17
- "test:date:util": "set NODE_ENV=local && node --experimental-vm-modules node_modules/jest/bin/jest.js run ./tests/DateUtil.test.ts"
18
- },
19
- "license": "ISC",
20
- "files": [
21
- "dist/**/*"
22
- ],
23
- "exports": {
24
- ".": {
25
- "types": "./dist/types/index.d.ts",
26
- "node": {
27
- "import": "./dist/esm/build/node/index.js",
28
- "require": "./dist/cjs/build/node/index.cjs"
29
- },
30
- "default": "./dist/browser/build/browser/index.js"
31
- },
32
- "./beans": {
33
- "types": "./dist/types/src/beans/index.d.ts",
34
- "node": {
35
- "import": "./dist/esm/beans/index.js",
36
- "require": "./dist/cjs/beans/index.cjs"
37
- },
38
- "default": "./dist/browser/beans/index.js"
39
- },
40
- "./types": {
41
- "types": "./dist/types/src/types/index.d.ts",
42
- "node": {
43
- "import": "./dist/esm/types/index.js",
44
- "require": "./dist/cjs/types/index.cjs"
45
- },
46
- "default": "./dist/browser/types/index.js"
47
- },
48
- "./utils": {
49
- "types": "./dist/types/src/utils/index.d.ts",
50
- "node": {
51
- "import": "./dist/esm/utils/index.js",
52
- "require": "./dist/cjs/utils/index.cjs"
53
- },
54
- "default": "./dist/browser/utils/index.js"
55
- },
56
- "./utils/date": {
57
- "types": "./dist/types/src/utils/date/index.d.ts",
58
- "node": {
59
- "import": "./dist/esm/utils/date/index.js",
60
- "require": "./dist/cjs/utils/date/index.cjs"
61
- },
62
- "default": "./dist/browser/utils/date/index.js"
63
- },
64
- "./logger": {
65
- "types": "./dist/types/src/logger/index.d.ts",
66
- "node": {
67
- "import": "./dist/esm/logger/index.js",
68
- "require": "./dist/cjs/logger/index.cjs"
69
- }
70
- },
71
- "./exceptions": {
72
- "types": "./dist/types/src/exceptions/index.d.ts",
73
- "node": {
74
- "import": "./dist/esm/exceptions/index.js",
75
- "require": "./dist/cjs/exceptions/index.cjs"
76
- },
77
- "default": "./dist/browser/exceptions/index.js"
78
- },
79
- "./package.json": "./package.json"
80
- },
81
- "typesVersions": {
82
- "*": {
83
- "*": [
84
- "dist/types/*"
85
- ],
86
- "beans": [
87
- "dist/types/src/beans/index.d.ts"
88
- ],
89
- "types": [
90
- "dist/types/src/types/index.d.ts"
91
- ],
92
- "utils": [
93
- "dist/types/src/utils/index.d.ts"
94
- ],
95
- "utils/date": [
96
- "dist/types/src/utils/date/index.d.ts"
97
- ],
98
- "exceptions": [
99
- "dist/types/src/exceptions/index.d.ts"
100
- ],
101
- "logger": [
102
- "dist/types/src/logger/index.d.ts"
103
- ]
104
- }
105
- },
106
- "directories": {
107
- "lib": "./dist"
108
- },
109
- "engines": {
110
- "node": ">=14"
111
- },
112
- "dependencies": {
113
- "@date-fns/tz": "^1.1.2",
114
- "class-transformer": "^0.5.1",
115
- "class-validator": "^0.14.1",
116
- "date-fns": "^4.1.0",
117
- "tslib": "^2.8.1",
118
- "winston": "^3.17.0"
119
- },
120
- "devDependencies": {
121
- "@rollup/plugin-commonjs": "^28.0.3",
122
- "@rollup/plugin-node-resolve": "^16.0.1",
123
- "@rollup/plugin-typescript": "^12.1.2",
124
- "@types/node": "^22.7.0",
125
- "@typescript-eslint/eslint-plugin": "^8.33.1",
126
- "@typescript-eslint/parser": "^8.33.1",
127
- "esbuild-plugin-eslint": "^0.3.7",
128
- "eslint": "^9.28.0",
129
- "eslint-config-prettier": "^10.1.5",
130
- "eslint-import-resolver-typescript": "^3.7.0",
131
- "glob": "^11.0.2",
132
- "rollup": "^4.40.2",
133
- "rollup-plugin-dts": "^6.2.1",
134
- "ts-node": "^10.9.2",
135
- "typescript": "^5.6.2",
136
- "@types/jest": "^29.5.12",
137
- "jest": "^29.7.0",
138
- "ts-jest": "^29.2.5"
139
- }
140
- }
1
+ {
2
+ "name": "@org-quicko/core",
3
+ "version": "2.0.6",
4
+ "description": "A library in typescript for common entities and utilities across Quicko",
5
+ "author": "Quicko",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/org-quicko/core-js"
9
+ },
10
+ "homepage": "https://github.com/org-quicko/core-js",
11
+ "bugs": {
12
+ "url": "https://github.com/org-quicko/core-js/issues"
13
+ },
14
+ "main": "dist/cjs/build/node/index.cjs",
15
+ "module": "dist/esm/build/node/index.js",
16
+ "browser": "dist/browser/build/browser/index.js",
17
+ "types": "dist/types/index.d.ts",
18
+ "type": "module",
19
+ "scripts": {
20
+ "clean": "rm -rf ./dist",
21
+ "clean:all": "rm -rf ./node_modules ./package-lock.json ./dist && npm cache clean --force",
22
+ "lint": "eslint .",
23
+ "lint:fix": "eslint . --fix",
24
+ "prebuild": "npm run clean && npm run lint",
25
+ "build": "rollup -c",
26
+ "test": "set NODE_ENV=local && node --experimental-vm-modules node_modules/jest/bin/jest.js",
27
+ "test:date:util": "set NODE_ENV=local && node --experimental-vm-modules node_modules/jest/bin/jest.js run ./tests/DateUtil.test.ts"
28
+ },
29
+ "license": "ISC",
30
+ "files": [
31
+ "dist/**/*"
32
+ ],
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/types/index.d.ts",
36
+ "node": {
37
+ "import": "./dist/esm/build/node/index.js",
38
+ "require": "./dist/cjs/build/node/index.cjs"
39
+ },
40
+ "default": "./dist/browser/build/browser/index.js"
41
+ },
42
+ "./beans": {
43
+ "types": "./dist/types/src/beans/index.d.ts",
44
+ "node": {
45
+ "import": "./dist/esm/beans/index.js",
46
+ "require": "./dist/cjs/beans/index.cjs"
47
+ },
48
+ "default": "./dist/browser/beans/index.js"
49
+ },
50
+ "./types": {
51
+ "types": "./dist/types/src/types/index.d.ts",
52
+ "node": {
53
+ "import": "./dist/esm/types/index.js",
54
+ "require": "./dist/cjs/types/index.cjs"
55
+ },
56
+ "default": "./dist/browser/types/index.js"
57
+ },
58
+ "./utils": {
59
+ "types": "./dist/types/src/utils/index.d.ts",
60
+ "node": {
61
+ "import": "./dist/esm/utils/index.js",
62
+ "require": "./dist/cjs/utils/index.cjs"
63
+ },
64
+ "default": "./dist/browser/utils/index.js"
65
+ },
66
+ "./utils/date": {
67
+ "types": "./dist/types/src/utils/date/index.d.ts",
68
+ "node": {
69
+ "import": "./dist/esm/utils/date/index.js",
70
+ "require": "./dist/cjs/utils/date/index.cjs"
71
+ },
72
+ "default": "./dist/browser/utils/date/index.js"
73
+ },
74
+ "./logger": {
75
+ "types": "./dist/types/src/logger/index.d.ts",
76
+ "node": {
77
+ "import": "./dist/esm/logger/index.js",
78
+ "require": "./dist/cjs/logger/index.cjs"
79
+ }
80
+ },
81
+ "./exceptions": {
82
+ "types": "./dist/types/src/exceptions/index.d.ts",
83
+ "node": {
84
+ "import": "./dist/esm/exceptions/index.js",
85
+ "require": "./dist/cjs/exceptions/index.cjs"
86
+ },
87
+ "default": "./dist/browser/exceptions/index.js"
88
+ },
89
+ "./package.json": "./package.json"
90
+ },
91
+ "directories": {
92
+ "lib": "./dist"
93
+ },
94
+ "dependencies": {
95
+ "@date-fns/tz": "^1.1.2",
96
+ "class-transformer": "^0.5.1",
97
+ "class-validator": "^0.14.1",
98
+ "date-fns": "^4.1.0",
99
+ "tslib": "^2.8.1",
100
+ "winston": "^3.17.0"
101
+ },
102
+ "devDependencies": {
103
+ "@rollup/plugin-commonjs": "^28.0.3",
104
+ "@rollup/plugin-node-resolve": "^16.0.1",
105
+ "@rollup/plugin-typescript": "^12.1.2",
106
+ "@types/jest": "^29.5.12",
107
+ "@types/node": "^22.7.0",
108
+ "@typescript-eslint/eslint-plugin": "^8.33.1",
109
+ "@typescript-eslint/parser": "^8.33.1",
110
+ "esbuild-plugin-eslint": "^0.3.7",
111
+ "eslint": "^9.28.0",
112
+ "eslint-config-prettier": "^10.1.5",
113
+ "eslint-import-resolver-typescript": "^3.7.0",
114
+ "glob": "^11.0.2",
115
+ "jest": "^29.7.0",
116
+ "rollup": "^4.40.2",
117
+ "rollup-plugin-dts": "^6.2.1",
118
+ "rollup-plugin-node-externals": "^8.1.2",
119
+ "ts-jest": "^29.2.5",
120
+ "ts-node": "^10.9.2",
121
+ "typescript": "^5.6.2"
122
+ }
123
+ }