@dereekb/date 12.6.21 → 13.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/date",
3
- "version": "12.6.21",
3
+ "version": "13.0.0",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
@@ -15,17 +15,19 @@
15
15
  }
16
16
  },
17
17
  "peerDependencies": {
18
- "@dereekb/util": "*",
19
- "date-fns": "^3.0.0",
20
- "date-fns-tz": "^3.0.0",
18
+ "@dereekb/util": "13.0.0",
19
+ "@dereekb/rxjs": "13.0.0",
20
+ "date-fns": "^4.0.0",
21
+ "date-fns-tz": "^3.2.0",
21
22
  "class-transformer": "^0.5.1",
22
- "class-validator": "^0.14.0",
23
- "rxjs": "^7.4.0",
23
+ "class-validator": "^0.15.1",
24
+ "rxjs": "^7.8.0",
24
25
  "rrule": "git+https://git@github.com/dereekb/rrule#2b13b1ea881059ba2ecfec380e12ef244ef54570",
25
- "@vvo/tzdb": "^6.0.0"
26
+ "@vvo/tzdb": "^6.0.0",
27
+ "core-js": "^3.0.0"
26
28
  },
27
29
  "dependencies": {},
28
30
  "module": "./index.esm.js",
29
31
  "main": "./index.cjs.js",
30
- "types": "./index.esm.d.ts"
32
+ "types": "./index.d.ts"
31
33
  }
@@ -1,4 +1,4 @@
1
- import { type DayOfWeekNameFunction, type DateOrDateString, type ISO8601DateString, type Maybe, type Minutes, type Seconds, type TimezoneString, type ArrayOrValue, type MapFunction, type ISO8601DateStringUTCFull, type UTCDateString, type DayOfWeek, type UnixDateTimeNumber, type DateOrUnixDateTimeNumber, type DateHourMinuteOrSecond, type FloorOrCeilRounding } from '@dereekb/util';
1
+ import { type DayOfWeekNameFunction, type DateOrDateString, type ISO8601DateString, type Maybe, type Minutes, type Seconds, type TimezoneString, type ArrayOrValue, type MapFunction, type ISO8601DateStringUTCFull, type UTCDateString, type DayOfWeek, type UnixDateTimeMillisecondsNumber, type DateOrUnixDateTimeMillisecondsNumber, type DateHourMinuteOrSecond, type FloorOrCeilRounding } from '@dereekb/util';
2
2
  export declare const MAX_FUTURE_DATE: Date;
3
3
  /**
4
4
  * Reads a date from the input value
@@ -43,8 +43,8 @@ export declare function safeToJsDate(input: Maybe<DateOrDateString | UTCDateStri
43
43
  * @param input
44
44
  * @returns
45
45
  */
46
- export declare function toJsDate(input: DateOrDateString | UTCDateString | UnixDateTimeNumber): Date;
47
- export declare function parseJsDateString(input: ISO8601DateString | UTCDateString | UnixDateTimeNumber): Maybe<Date>;
46
+ export declare function toJsDate(input: DateOrDateString | UTCDateString | UnixDateTimeMillisecondsNumber): Date;
47
+ export declare function parseJsDateString(input: ISO8601DateString | UTCDateString | UnixDateTimeMillisecondsNumber): Maybe<Date>;
48
48
  /**
49
49
  * Returns the earliest date from the input array.
50
50
  */
@@ -102,34 +102,6 @@ export declare function isSameDateDay(a: Maybe<Date>, b: Maybe<Date>, defaultVal
102
102
  * For example, 1/1/2021 should be represented as a UTC-offset date for 1/1/2021 for the first instant of the day.
103
103
  */
104
104
  export declare function utcDayForDate(date: Date): Date;
105
- /**
106
- * Takes the next occuring time of the input date's hours/minutes.
107
- *
108
- * For example, if it is currently 9PM:
109
- * - if 10PM on any day is passed then 9PM the next day will be returned.
110
- * - if 11PM on any day is passed, 11PM today will be returned.
111
- *
112
- * @deprecated Fails in the rare case where it is the first two hours of a day in a daylight savings zone when daylight savings changes.
113
- */
114
- export declare function takeNextUpcomingTime(date: Date, roundDownToMinute?: boolean): Date;
115
- /**
116
- * Creates a new date and copies the hours/minutes from the previous date and applies them to a date for today.
117
- *
118
- * @deprecated Fails in the rare case where it is the first two hours of a day in a daylight savings zone when daylight savings changes.
119
- */
120
- export declare function copyHoursAndMinutesFromDateToToday(fromDate: Date, roundDownToMinute?: boolean): Date;
121
- /**
122
- * Copies the hours/minutes from now to the target date.
123
- *
124
- * @deprecated Fails in the rare case where it is the first two hours of a day in a daylight savings zone when daylight savings changes.
125
- */
126
- export declare function copyHoursAndMinutesFromNow(target: Date, roundDownToMinute?: boolean): Date;
127
- /**
128
- * Creates a new date and copies the hours/minutes from the input date to the target date.
129
- *
130
- * @deprecated Fails in the rare case where it is the first two hours of a day in a daylight savings zone when daylight savings changes.
131
- */
132
- export declare function copyHoursAndMinutesFromDate(target: Date, fromDate: Date, roundDownToMinute?: boolean): Date;
133
105
  /**
134
106
  * Creates a new date using UTC and copies the hours/minutes from the input date using the UTC values to the target date.
135
107
  */
@@ -156,8 +128,8 @@ export declare function roundDownToMinute(date?: Date): Date;
156
128
  export declare function roundDownToHour(date?: Date): Date;
157
129
  export declare function roundDateDownTo(date: Date, roundToUnit: DateHourMinuteOrSecond): Date;
158
130
  export declare function roundDateTo(date: Date, roundToUnit: DateHourMinuteOrSecond, roundType?: FloorOrCeilRounding): Date;
159
- export declare function roundDateTo(unixDateTimeNumber: UnixDateTimeNumber, roundToUnit: DateHourMinuteOrSecond, roundType?: FloorOrCeilRounding): UnixDateTimeNumber;
160
- export declare function roundDateToDate(date: DateOrUnixDateTimeNumber, roundToUnit: DateHourMinuteOrSecond, roundType?: FloorOrCeilRounding): Date;
131
+ export declare function roundDateTo(unixDateTimeNumber: UnixDateTimeMillisecondsNumber, roundToUnit: DateHourMinuteOrSecond, roundType?: FloorOrCeilRounding): UnixDateTimeMillisecondsNumber;
132
+ export declare function roundDateToDate(date: DateOrUnixDateTimeMillisecondsNumber, roundToUnit: DateHourMinuteOrSecond, roundType?: FloorOrCeilRounding): Date;
161
133
  /**
162
134
  * Rounds the input Date value down to the nearest hour, minute, or second.
163
135
  *
@@ -166,7 +138,7 @@ export declare function roundDateToDate(date: DateOrUnixDateTimeNumber, roundToU
166
138
  * @param roundType
167
139
  * @returns
168
140
  */
169
- export declare function roundDateToUnixDateTimeNumber(date: DateOrUnixDateTimeNumber, roundToUnit: DateHourMinuteOrSecond, roundType?: FloorOrCeilRounding): UnixDateTimeNumber;
141
+ export declare function roundDateToUnixDateTimeNumber(date: DateOrUnixDateTimeMillisecondsNumber, roundToUnit: DateHourMinuteOrSecond, roundType?: FloorOrCeilRounding): UnixDateTimeMillisecondsNumber;
170
142
  export type ReduceDatesFunction = (inputDates: ArrayOrValue<Maybe<Date>>) => Maybe<Date>;
171
143
  export declare function reduceDatesFunction(reduceDates: (dates: Date[]) => Maybe<Date>): ReduceDatesFunction;
172
144
  /**
@@ -1,6 +1,5 @@
1
- import { type DateRelativeState, type FractionalHour, type Minutes as UtilMinutes, type Maybe } from '@dereekb/util';
1
+ import { type DateRelativeState, type FractionalHour, type Minutes, type Maybe } from '@dereekb/util';
2
2
  import { type DateRange } from './date.range';
3
- export type Minutes = UtilMinutes;
4
3
  export interface DateDurationSpan {
5
4
  startsAt: Date;
6
5
  duration: Minutes;
@@ -155,15 +155,3 @@ export declare function formatStartedEndedDistanceString({ start, end }: DateRan
155
155
  */
156
156
  export declare function toJsDayDate(input: DateOrDayString): Date;
157
157
  export declare function parseISO8601DayStringToDate(dayString: ISO8601DayString | ISO8601DateString): Date;
158
- /**
159
- * @deprecated use toISO8601DayStringForSystem instead for clarity. Will be removed in the future.
160
- */
161
- export declare const toISO8601DayString: typeof toISO8601DayStringForSystem;
162
- /**
163
- * @deprecated use formatToISO8601DayStringForSystem instead for clarity. Will be removed in the future.
164
- */
165
- export declare const formatToISO8601DayString: typeof formatToISO8601DayStringForSystem;
166
- /**
167
- * @deprecated use formatToMonthDaySlashDate instead for clarity. Will be removed in the future.
168
- */
169
- export declare const dateShortDateStringFormat = "MM/dd/yyyy";
@@ -1 +1 @@
1
- export { unixDateTimeSecondsNumberFromDateOrTimeNumber, unixDateTimeSecondsNumberForNow, unixDateTimeSecondsNumberFromDate, dateFromDateOrTimeNumber, dateFromDateOrTimeMillisecondsNumber, unixDateTimeSecondsNumberToDate } from '@dereekb/util';
1
+ export { unixDateTimeSecondsNumberFromDateOrTimeNumber, unixDateTimeSecondsNumberForNow, unixDateTimeSecondsNumberFromDate, dateFromDateOrTimeMillisecondsNumber, unixDateTimeSecondsNumberToDate } from '@dereekb/util';
@@ -1,5 +1,4 @@
1
1
  export * from './date';
2
- export * from './expires';
3
2
  export * from './query';
4
3
  export * from './rrule';
5
4
  export * from './timezone';
@@ -1,8 +1,7 @@
1
1
  import { type CalendarDate, type DateRange } from '../date';
2
2
  import { type DateRRuleInstance } from './date.rrule';
3
3
  import { type RRuleLines, type RRuleStringLineSet } from './date.rrule.parse';
4
- import { type TimezoneString as UtilTimezoneString } from '@dereekb/util';
5
- export type TimezoneString = UtilTimezoneString;
4
+ import { type TimezoneString } from '@dereekb/util';
6
5
  export interface RecurrenceModel {
7
6
  recur?: ModelRecurrenceInfo;
8
7
  recurs: boolean;
package/index.esm.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src/index";
@@ -1,49 +0,0 @@
1
- import { type Expires, type DateOrUnixDateTimeMillisecondsNumber, type Maybe, type Milliseconds } from '@dereekb/util';
2
- export type { Expires } from '@dereekb/util';
3
- /**
4
- * Returns true if any of the input items have expired.
5
- *
6
- * If the list is empty, returns false.
7
- *
8
- * @deprecated Use ExpirationDetails and checkAtleastOneNotExpired() instead.
9
- */
10
- export declare function atleastOneNotExpired(expires: Maybe<Expires>[]): boolean;
11
- /**
12
- * Returns true if any of the input items has expired.
13
- *
14
- * If the list is empty, returns the second argument, or true by default.
15
- *
16
- * @deprecated Use ExpirationDetails and checkAnyHaveExpired() instead.
17
- */
18
- export declare function anyHaveExpired(expires: Maybe<Expires>[], expireIfEmpty?: boolean): boolean;
19
- /**
20
- * Convenience function for checking if the input time has expired.
21
- *
22
- * @param timeNumber
23
- * @param expiresIn
24
- * @returns
25
- *
26
- * @deprecated Use isThrottled() or expirationDetails({ expiresFromDate: time, expiresIn }).hasExpired() instead.
27
- */
28
- export declare function timeHasExpired(time: Maybe<DateOrUnixDateTimeMillisecondsNumber>, expiresIn?: Milliseconds): boolean;
29
- /**
30
- * Creates an Expires object from the input date or time number.
31
- *
32
- * @deprecated Use ExpirationDetails instead.
33
- *
34
- * @param timeNumber Number to convert to a date.
35
- * @param expiresIn If the input number is the initial date, and not the expiration date, this is used to find the expiresAt time.
36
- */
37
- export declare function toExpires(time: Maybe<DateOrUnixDateTimeMillisecondsNumber>, expiresIn?: Milliseconds): Expires;
38
- /**
39
- * Checks whether or not the item has expired. If no expiration date is set, it is considered expired.
40
- *
41
- * @deprecated Use ExpirationDetails instead.
42
- */
43
- export declare function hasExpired(expires: Maybe<Expires>): boolean;
44
- /**
45
- * Returns the expiration date, or a date 1 minute in the past if not defined.
46
- *
47
- * @deprecated Use ExpirationDetails instead.
48
- */
49
- export declare function getExpiration(expires: Maybe<Expires>): Date;
@@ -1,30 +0,0 @@
1
- import { type Milliseconds, type DateOrUnixDateTimeNumber } from '@dereekb/util';
2
- import { type MonoTypeOperatorFunction, type Observable, type OperatorFunction } from 'rxjs';
3
- import { type Expires } from './expires';
4
- /**
5
- * Creates a new Expires object at the current time on emission that will expire in the set amount of time.
6
- *
7
- * @param expiresIn
8
- * @returns
9
- */
10
- export declare function toExpiration<T>(expiresIn: number): OperatorFunction<T, Expires>;
11
- /**
12
- * Filters further emissions once the input is expired.
13
- */
14
- export declare function skipExpired<T extends Expires>(): MonoTypeOperatorFunction<T>;
15
- /**
16
- * Skips the input date or timenumber until expiration occurs.
17
- */
18
- export declare function skipUntilExpiration(expiresIn?: number): MonoTypeOperatorFunction<DateOrUnixDateTimeNumber>;
19
- /**
20
- * Skips the input date or timenumber after expiration occurs.
21
- */
22
- export declare function skipAfterExpiration(expiresIn?: number): MonoTypeOperatorFunction<DateOrUnixDateTimeNumber>;
23
- /**
24
- * Skips emissions until time since the last emission from the watch observable has elapsed.
25
- */
26
- export declare function skipUntilTimeElapsedAfterLastEmission<T>(watch: Observable<unknown>, takeFor: Milliseconds): MonoTypeOperatorFunction<T>;
27
- /**
28
- * Takes emissions until time since the last emission from the watch observable has elapsed.
29
- */
30
- export declare function takeAfterTimeElapsedSinceLastEmission<T>(watch: Observable<unknown>, skipFor: Milliseconds): MonoTypeOperatorFunction<T>;
@@ -1,2 +0,0 @@
1
- export * from './expires';
2
- export * from './expires.rxjs';
File without changes