scdate 0.2.2 → 0.2.4

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.
package/README.md CHANGED
@@ -37,6 +37,6 @@ The library was designed with schedules in mind that do not require second or sm
37
37
 
38
38
  For a list of valid time zones run `Intl.supportedValuesOf('timeZone')` in your environment.
39
39
 
40
- # API Reference
40
+ ## API Reference
41
41
 
42
42
  See [docs](docs/README.md)
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export * from './constants';
2
- export * from './sDate';
3
- export * from './sTime';
4
- export * from './sTimestamp';
5
- export * from './sWeekdays';
6
- export type * from './internal/SDate';
7
- export type * from './internal/STime';
8
- export type * from './internal/STimestamp';
9
- export type * from './internal/SWeekdays';
1
+ export * from './constants.js';
2
+ export * from './sDate.js';
3
+ export * from './sTime.js';
4
+ export * from './sTimestamp.js';
5
+ export * from './sWeekdays.js';
6
+ export type * from './internal/SDate.js';
7
+ export type * from './internal/STime.js';
8
+ export type * from './internal/STimestamp.js';
9
+ export type * from './internal/SWeekdays.js';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export * from './constants';
2
- export * from './sDate';
3
- export * from './sTime';
4
- export * from './sTimestamp';
5
- export * from './sWeekdays';
1
+ export * from './constants.js';
2
+ export * from './sDate.js';
3
+ export * from './sTime.js';
4
+ export * from './sTimestamp.js';
5
+ export * from './sWeekdays.js';
@@ -1,4 +1,4 @@
1
- import { validateISODate } from './date';
1
+ import { validateISODate } from './date.js';
2
2
  export class SDate {
3
3
  date;
4
4
  constructor(isoValue) {
@@ -1,4 +1,4 @@
1
- import { validateISOTime } from './time';
1
+ import { validateISOTime } from './time.js';
2
2
  export class STime {
3
3
  time;
4
4
  constructor(isoValue) {
@@ -1,4 +1,4 @@
1
- import { validateISOTimestamp } from './timestamp';
1
+ import { validateISOTimestamp } from './timestamp.js';
2
2
  export class STimestamp {
3
3
  timestamp;
4
4
  constructor(timestamp) {
@@ -1,4 +1,4 @@
1
- import { validateWeekdays } from './weekdays';
1
+ import { validateWeekdays } from './weekdays.js';
2
2
  export class SWeekdays {
3
3
  weekdays;
4
4
  constructor(weekdays) {
@@ -1,4 +1,4 @@
1
- import { Weekday } from '../constants';
1
+ import { Weekday } from '../constants.js';
2
2
  export declare const DayToWeekday: Weekday[];
3
3
  export declare const DaysInWeek = 7;
4
4
  export declare const MinutesInDay = 1440;
@@ -1,4 +1,4 @@
1
- import { Weekday } from '../constants';
1
+ import { Weekday } from '../constants.js';
2
2
  export const DayToWeekday = [
3
3
  Weekday.Sun,
4
4
  Weekday.Mon,
@@ -1,5 +1,5 @@
1
1
  import { UTCDateMini } from '@date-fns/utc';
2
- import { SDate } from './SDate';
2
+ import { SDate } from './SDate.js';
3
3
  export declare const getISOYearFromISODate: (isoDate: string) => string;
4
4
  export declare const getISOMonthFromISODate: (isoDate: string) => string;
5
5
  export declare const getISODateFromISODate: (isoDate: string) => string;
@@ -1,5 +1,5 @@
1
1
  import { UTCDateMini } from '@date-fns/utc';
2
- import { STimestamp } from './STimestamp';
2
+ import { STimestamp } from './STimestamp.js';
3
3
  export declare const getISODateFromISOTimestamp: (isoTimestamp: string) => string;
4
4
  export declare const getISOTimeFromISOTimestamp: (isoTimestamp: string) => string;
5
5
  export declare const getISOTimestampFromZonedDate: (date: Date) => string;
@@ -1,6 +1,6 @@
1
1
  import { UTCDateMini } from '@date-fns/utc';
2
- import { getISODateFromZonedDate, validateISODate } from './date';
3
- import { getISOTimeFromDate, validateISOTime } from './time';
2
+ import { getISODateFromZonedDate, validateISODate } from './date.js';
3
+ import { getISOTimeFromDate, validateISOTime } from './time.js';
4
4
  export const getISODateFromISOTimestamp = (isoTimestamp) => {
5
5
  const EndOfDateIndex = 10;
6
6
  return isoTimestamp.slice(0, EndOfDateIndex);
@@ -1,3 +1,3 @@
1
- import { Weekday } from '../constants';
1
+ import { Weekday } from '../constants.js';
2
2
  export declare const validateWeekdays: (weekdays: string) => void;
3
3
  export declare const getIndexForWeekday: (weekday: Weekday) => number;
@@ -1,4 +1,4 @@
1
- import { DayToWeekday } from './constants';
1
+ import { DayToWeekday } from './constants.js';
2
2
  export const validateWeekdays = (weekdays) => {
3
3
  const ValidWeekdays = /^[S-][M-][T-][W-][T-][F-][S-]$/;
4
4
  if (!ValidWeekdays.test(weekdays)) {
@@ -1,5 +1,5 @@
1
- import { SDate } from './SDate';
2
- import { STimestamp } from './STimestamp';
1
+ import { SDate } from './SDate.js';
2
+ import { STimestamp } from './STimestamp.js';
3
3
  export declare const getMillisecondsInUTCFromTimestamp: (timestamp: STimestamp, timeZone: string) => number;
4
4
  export declare const getMillisecondsInUTCFromDate: (date: SDate, timeZone: string) => number;
5
5
  export declare const getTimeZonedDate: (millisecondsInUTC: number, timeZone: string) => Date;
@@ -1,6 +1,6 @@
1
1
  import { getTimezoneOffset, toZonedTime } from 'date-fns-tz';
2
- import { getDateAsUTCDateMini } from './date';
3
- import { getTimestampAsUTCDateMini } from './timestamp';
2
+ import { getDateAsUTCDateMini } from './date.js';
3
+ import { getTimestampAsUTCDateMini } from './timestamp.js';
4
4
  const getValidatedTimeZoneOffset = (timeZone, utcDate) => {
5
5
  const timeZoneOffset = getTimezoneOffset(timeZone, utcDate);
6
6
  if (isNaN(timeZoneOffset)) {
package/dist/sDate.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Weekday } from './constants';
2
- import { SDate } from './internal/SDate';
1
+ import { Weekday } from './constants.js';
2
+ import { SDate } from './internal/SDate.js';
3
3
  export interface SDateShortStringOptions {
4
4
  includeWeekday: boolean;
5
5
  onTodayText: () => string;
package/dist/sDate.js CHANGED
@@ -1,9 +1,9 @@
1
- import { SDate } from './internal/SDate';
2
- import { DayToWeekday, DaysInWeek, MillisecondsInDay, } from './internal/constants';
3
- import { getDateAsUTCDateMini, getISODateFromISODate, getISODateFromZonedDate, getISOMonthFromISODate, getISOYearFromISODate, } from './internal/date';
4
- import { getAtIndex } from './internal/utils';
5
- import { getIndexForWeekday } from './internal/weekdays';
6
- import { getMillisecondsInUTCFromDate, getTimeZonedDate, } from './internal/zoned';
1
+ import { SDate } from './internal/SDate.js';
2
+ import { DayToWeekday, DaysInWeek, MillisecondsInDay, } from './internal/constants.js';
3
+ import { getDateAsUTCDateMini, getISODateFromISODate, getISODateFromZonedDate, getISOMonthFromISODate, getISOYearFromISODate, } from './internal/date.js';
4
+ import { getAtIndex } from './internal/utils.js';
5
+ import { getIndexForWeekday } from './internal/weekdays.js';
6
+ import { getMillisecondsInUTCFromDate, getTimeZonedDate, } from './internal/zoned.js';
7
7
  export const sDate = (date) => {
8
8
  if (date instanceof SDate) {
9
9
  return date;
package/dist/sTime.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { STime } from './internal/STime';
1
+ import { STime } from './internal/STime.js';
2
2
  export declare const sTime: (time: string | STime) => STime;
3
3
  export declare const getTimeNow: (timeZone: string) => STime;
4
4
  export declare const getTimeAtMidnight: () => STime;
package/dist/sTime.js CHANGED
@@ -1,7 +1,7 @@
1
- import { STime } from './internal/STime';
2
- import { MinutesInDay, MinutesInHour } from './internal/constants';
3
- import { getISOHoursFromISOTime, getISOMinutesFromISOTime, getISOTimeFromDate, } from './internal/time';
4
- import { getTimeZonedDate } from './internal/zoned';
1
+ import { STime } from './internal/STime.js';
2
+ import { MinutesInDay, MinutesInHour } from './internal/constants.js';
3
+ import { getISOHoursFromISOTime, getISOMinutesFromISOTime, getISOTimeFromDate, } from './internal/time.js';
4
+ import { getTimeZonedDate } from './internal/zoned.js';
5
5
  export const sTime = (time) => {
6
6
  if (time instanceof STime) {
7
7
  return time;
@@ -1,6 +1,6 @@
1
- import { SDate } from './internal/SDate';
2
- import { STime } from './internal/STime';
3
- import { STimestamp } from './internal/STimestamp';
1
+ import { SDate } from './internal/SDate.js';
2
+ import { STime } from './internal/STime.js';
3
+ import { STimestamp } from './internal/STimestamp.js';
4
4
  export interface STimestampShortStringOptions {
5
5
  includeWeekday: boolean;
6
6
  onTodayAtText: () => string;
@@ -1,9 +1,9 @@
1
- import { STimestamp } from './internal/STimestamp';
2
- import { MillisecondsInMinute, MillisecondsInSecond, } from './internal/constants';
3
- import { getISODateFromISOTimestamp, getISOTimeFromISOTimestamp, getISOTimestampFromZonedDate, getTimestampAsUTCDateMini, } from './internal/timestamp';
4
- import { getMillisecondsInUTCFromTimestamp, getTimeZonedDate, } from './internal/zoned';
5
- import { getShortDateString, sDate } from './sDate';
6
- import { get12HourTimeString, sTime } from './sTime';
1
+ import { STimestamp } from './internal/STimestamp.js';
2
+ import { MillisecondsInMinute, MillisecondsInSecond, } from './internal/constants.js';
3
+ import { getISODateFromISOTimestamp, getISOTimeFromISOTimestamp, getISOTimestampFromZonedDate, getTimestampAsUTCDateMini, } from './internal/timestamp.js';
4
+ import { getMillisecondsInUTCFromTimestamp, getTimeZonedDate, } from './internal/zoned.js';
5
+ import { getShortDateString, sDate } from './sDate.js';
6
+ import { get12HourTimeString, sTime } from './sTime.js';
7
7
  export const sTimestamp = (timestamp) => {
8
8
  if (timestamp instanceof STimestamp) {
9
9
  return timestamp;
@@ -1,6 +1,6 @@
1
- import { Weekday } from './constants';
2
- import { SDate } from './internal/SDate';
3
- import { SWeekdays } from './internal/SWeekdays';
1
+ import { Weekday } from './constants.js';
2
+ import { SDate } from './internal/SDate.js';
3
+ import { SWeekdays } from './internal/SWeekdays.js';
4
4
  export declare const sWeekdays: (weekdays: string | SWeekdays) => SWeekdays;
5
5
  export declare const getWeekdaysFromWeekdayFlags: (weekdays: Weekday) => SWeekdays;
6
6
  export declare const getWeekdaysWithAllIncluded: () => SWeekdays;
package/dist/sWeekdays.js CHANGED
@@ -1,8 +1,8 @@
1
- import { SWeekdays } from './internal/SWeekdays';
2
- import { DayToWeekday, DaysInWeek } from './internal/constants';
3
- import { getAtIndex, hasFlag } from './internal/utils';
4
- import { getIndexForWeekday } from './internal/weekdays';
5
- import { addDaysToDate, getDaysBetweenDates, getWeekdayFromDate, isAfterDate, isSameDateOrBefore, sDate, } from './sDate';
1
+ import { SWeekdays } from './internal/SWeekdays.js';
2
+ import { DayToWeekday, DaysInWeek } from './internal/constants.js';
3
+ import { getAtIndex, hasFlag } from './internal/utils.js';
4
+ import { getIndexForWeekday } from './internal/weekdays.js';
5
+ import { addDaysToDate, getDaysBetweenDates, getWeekdayFromDate, isAfterDate, isSameDateOrBefore, sDate, } from './sDate.js';
6
6
  const AllWeekdaysIncludedMask = 'SMTWTFS';
7
7
  const NotIncludedDay = '-';
8
8
  const NoWeekdaysIncluded = NotIncludedDay.repeat(AllWeekdaysIncludedMask.length);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scdate",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dist/index.js"
@@ -25,10 +25,9 @@
25
25
  "smoke": "yarn build && yarn lint && yarn test:utc",
26
26
  "docs": "typedoc && prettier --ignore-unknown --write docs/",
27
27
  "-- PRE-COMMIT HOOKS --": "",
28
- "postinstall": "husky install",
28
+ "postinstall": "husky || true",
29
29
  "prepublishOnly": "pinst --disable",
30
- "postpublish": "pinst --enable",
31
- "prepare": "husky"
30
+ "postpublish": "pinst --enable"
32
31
  },
33
32
  "dependencies": {
34
33
  "@date-fns/utc": "^1.2.0",
@@ -36,20 +35,21 @@
36
35
  "date-fns-tz": "^3.1.3"
37
36
  },
38
37
  "devDependencies": {
39
- "@eslint/js": "^9.1.1",
38
+ "@eslint/js": "^9.2.0",
40
39
  "@tsconfig/strictest": "^2.0.5",
41
- "@types/node": "^20.12.7",
42
- "eslint": "^9.1.1",
40
+ "@types/node": "^20.12.11",
41
+ "eslint": "^9.2.0",
43
42
  "husky": "^9.0.11",
43
+ "is-ci": "^3.0.1",
44
44
  "lint-staged": "^15.2.2",
45
45
  "pinst": "^3.0.0",
46
46
  "prettier": "^3.2.5",
47
- "rimraf": "^5.0.5",
47
+ "rimraf": "^5.0.7",
48
48
  "typedoc": "^0.25.13",
49
- "typedoc-plugin-markdown": "^4.0.0-next.60",
49
+ "typedoc-plugin-markdown": "^4.0.2",
50
50
  "typescript": "^5.4.5",
51
- "typescript-eslint": "^7.8.0",
52
- "vitest": "^1.5.2"
51
+ "typescript-eslint": "^7.9.0",
52
+ "vitest": "^1.6.0"
53
53
  },
54
54
  "prettier": {
55
55
  "tabWidth": 2,
@@ -69,6 +69,7 @@
69
69
  "schedule",
70
70
  "timestamp"
71
71
  ],
72
+ "license": "MIT",
72
73
  "lint-staged": {
73
74
  "*.{ts,tsx,mjs}": "eslint --cache",
74
75
  "*": "prettier --ignore-unknown --write"