@dereekb/date 12.3.0 → 12.3.2
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/index.cjs.js +48 -33
- package/index.esm.js +48 -33
- package/package.json +1 -1
- package/src/lib/date/date.cell.d.ts +17 -4
- package/src/lib/date/date.cell.factory.d.ts +0 -9
package/index.cjs.js
CHANGED
|
@@ -4691,13 +4691,7 @@ function shiftDateCellTimingToUTCTimezone(timing) {
|
|
|
4691
4691
|
function shiftDateCellTimingToTimezone(timing, timezone) {
|
|
4692
4692
|
return shiftDateCellTimingToTimezoneFunction(timezone)(timing);
|
|
4693
4693
|
}
|
|
4694
|
-
|
|
4695
|
-
* Returns the expected duration from the input.
|
|
4696
|
-
*
|
|
4697
|
-
* @param timing
|
|
4698
|
-
* @returns
|
|
4699
|
-
*/
|
|
4700
|
-
function calculateExpectedDateCellTimingDurationPair(timing) {
|
|
4694
|
+
function _calculateExpectedDateCellTimingDurationPair(timing) {
|
|
4701
4695
|
const {
|
|
4702
4696
|
end,
|
|
4703
4697
|
startsAt,
|
|
@@ -4720,6 +4714,24 @@ function calculateExpectedDateCellTimingDurationPair(timing) {
|
|
|
4720
4714
|
}
|
|
4721
4715
|
const finalMsDifferenceBetweenStartAndEnd = dateFns.differenceInMilliseconds(endInUtcNormal, startsAtInUtcNormal);
|
|
4722
4716
|
const duration = finalMsDifferenceBetweenStartAndEnd / util.MS_IN_MINUTE % util.MINUTES_IN_DAY || util.MINUTES_IN_DAY;
|
|
4717
|
+
return {
|
|
4718
|
+
duration,
|
|
4719
|
+
normalInstance,
|
|
4720
|
+
endInUtcNormal
|
|
4721
|
+
};
|
|
4722
|
+
}
|
|
4723
|
+
/**
|
|
4724
|
+
* Returns the expected duration from the input.
|
|
4725
|
+
*
|
|
4726
|
+
* @param timing DateCellTimingStartsAtEndRange
|
|
4727
|
+
* @returns CalculateExpectedDateCellTimingDurationPair
|
|
4728
|
+
*/
|
|
4729
|
+
function calculateExpectedDateCellTimingDurationPair(timing) {
|
|
4730
|
+
const {
|
|
4731
|
+
duration,
|
|
4732
|
+
normalInstance,
|
|
4733
|
+
endInUtcNormal
|
|
4734
|
+
} = _calculateExpectedDateCellTimingDurationPair(timing);
|
|
4723
4735
|
const expectedFinalStartsAtUtc = dateFns.addMinutes(endInUtcNormal, -duration);
|
|
4724
4736
|
const expectedFinalStartsAt = normalInstance.targetDateToBaseDate(expectedFinalStartsAtUtc); // 2024-11-03T03:00:00.000Z
|
|
4725
4737
|
return {
|
|
@@ -4727,14 +4739,40 @@ function calculateExpectedDateCellTimingDurationPair(timing) {
|
|
|
4727
4739
|
expectedFinalStartsAt
|
|
4728
4740
|
};
|
|
4729
4741
|
}
|
|
4742
|
+
/**
|
|
4743
|
+
* Returns the duration calculated from the input.
|
|
4744
|
+
*
|
|
4745
|
+
* @param timing DateCellTimingStartsAtEndRange
|
|
4746
|
+
* @returns Minutes
|
|
4747
|
+
*/
|
|
4730
4748
|
function calculateExpectedDateCellTimingDuration(timing) {
|
|
4731
|
-
return
|
|
4749
|
+
return _calculateExpectedDateCellTimingDurationPair(timing).duration;
|
|
4750
|
+
}
|
|
4751
|
+
/**
|
|
4752
|
+
* Creates a DateCellTiming from the input timing by using calculateExpectedDateCellTimingDuration()
|
|
4753
|
+
*
|
|
4754
|
+
* @param timing DateCellTimingStartsAtEndRange
|
|
4755
|
+
* @returns DateCellTiming
|
|
4756
|
+
*/
|
|
4757
|
+
function dateCellTimingFromDateCellTimingStartsAtEndRange(timing) {
|
|
4758
|
+
const {
|
|
4759
|
+
startsAt,
|
|
4760
|
+
end,
|
|
4761
|
+
timezone
|
|
4762
|
+
} = timing;
|
|
4763
|
+
const duration = calculateExpectedDateCellTimingDuration(timing);
|
|
4764
|
+
return {
|
|
4765
|
+
startsAt,
|
|
4766
|
+
duration,
|
|
4767
|
+
end,
|
|
4768
|
+
timezone
|
|
4769
|
+
};
|
|
4732
4770
|
}
|
|
4733
4771
|
/**
|
|
4734
4772
|
* Returns the final StartsAt time.
|
|
4735
4773
|
*
|
|
4736
|
-
* @param timing
|
|
4737
|
-
* @returns
|
|
4774
|
+
* @param timing DateCellTimingStartsAtEndRange
|
|
4775
|
+
* @returns DateCellTimingEvent
|
|
4738
4776
|
*/
|
|
4739
4777
|
function dateCellTimingFinalStartsAtEvent(timing) {
|
|
4740
4778
|
const {
|
|
@@ -6088,29 +6126,6 @@ function dateCellTimingEndDateFactory(input) {
|
|
|
6088
6126
|
function getRelativeDateForDateCellTiming(timing, input) {
|
|
6089
6127
|
return dateCellTimingDateFactory(timing)(input);
|
|
6090
6128
|
}
|
|
6091
|
-
/**
|
|
6092
|
-
* Converts a DateCellTimingStartsAtEndRange to a DateCellTiming by calculating the difference in hours from the last startsAt timing and the end.
|
|
6093
|
-
*
|
|
6094
|
-
* @param dateCellTimingStartEndRange
|
|
6095
|
-
* @param event
|
|
6096
|
-
* @param timezone
|
|
6097
|
-
* @returns
|
|
6098
|
-
*/
|
|
6099
|
-
function dateCellTimingFromDateCellTimingStartsAtEndRange(dateCellTimingStartsAtEndRange) {
|
|
6100
|
-
const {
|
|
6101
|
-
startsAt,
|
|
6102
|
-
timezone,
|
|
6103
|
-
end
|
|
6104
|
-
} = dateCellTimingStartsAtEndRange;
|
|
6105
|
-
const duration = calculateExpectedDateCellTimingDuration(dateCellTimingStartsAtEndRange);
|
|
6106
|
-
const timing = {
|
|
6107
|
-
timezone,
|
|
6108
|
-
end,
|
|
6109
|
-
startsAt,
|
|
6110
|
-
duration
|
|
6111
|
-
};
|
|
6112
|
-
return timing;
|
|
6113
|
-
}
|
|
6114
6129
|
/**
|
|
6115
6130
|
* Creates a new DateCellTiming from the input configuration.
|
|
6116
6131
|
*
|
package/index.esm.js
CHANGED
|
@@ -4690,13 +4690,7 @@ function shiftDateCellTimingToUTCTimezone(timing) {
|
|
|
4690
4690
|
function shiftDateCellTimingToTimezone(timing, timezone) {
|
|
4691
4691
|
return shiftDateCellTimingToTimezoneFunction(timezone)(timing);
|
|
4692
4692
|
}
|
|
4693
|
-
|
|
4694
|
-
* Returns the expected duration from the input.
|
|
4695
|
-
*
|
|
4696
|
-
* @param timing
|
|
4697
|
-
* @returns
|
|
4698
|
-
*/
|
|
4699
|
-
function calculateExpectedDateCellTimingDurationPair(timing) {
|
|
4693
|
+
function _calculateExpectedDateCellTimingDurationPair(timing) {
|
|
4700
4694
|
const {
|
|
4701
4695
|
end,
|
|
4702
4696
|
startsAt,
|
|
@@ -4719,6 +4713,24 @@ function calculateExpectedDateCellTimingDurationPair(timing) {
|
|
|
4719
4713
|
}
|
|
4720
4714
|
const finalMsDifferenceBetweenStartAndEnd = differenceInMilliseconds(endInUtcNormal, startsAtInUtcNormal);
|
|
4721
4715
|
const duration = finalMsDifferenceBetweenStartAndEnd / MS_IN_MINUTE % MINUTES_IN_DAY || MINUTES_IN_DAY;
|
|
4716
|
+
return {
|
|
4717
|
+
duration,
|
|
4718
|
+
normalInstance,
|
|
4719
|
+
endInUtcNormal
|
|
4720
|
+
};
|
|
4721
|
+
}
|
|
4722
|
+
/**
|
|
4723
|
+
* Returns the expected duration from the input.
|
|
4724
|
+
*
|
|
4725
|
+
* @param timing DateCellTimingStartsAtEndRange
|
|
4726
|
+
* @returns CalculateExpectedDateCellTimingDurationPair
|
|
4727
|
+
*/
|
|
4728
|
+
function calculateExpectedDateCellTimingDurationPair(timing) {
|
|
4729
|
+
const {
|
|
4730
|
+
duration,
|
|
4731
|
+
normalInstance,
|
|
4732
|
+
endInUtcNormal
|
|
4733
|
+
} = _calculateExpectedDateCellTimingDurationPair(timing);
|
|
4722
4734
|
const expectedFinalStartsAtUtc = addMinutes(endInUtcNormal, -duration);
|
|
4723
4735
|
const expectedFinalStartsAt = normalInstance.targetDateToBaseDate(expectedFinalStartsAtUtc); // 2024-11-03T03:00:00.000Z
|
|
4724
4736
|
return {
|
|
@@ -4726,14 +4738,40 @@ function calculateExpectedDateCellTimingDurationPair(timing) {
|
|
|
4726
4738
|
expectedFinalStartsAt
|
|
4727
4739
|
};
|
|
4728
4740
|
}
|
|
4741
|
+
/**
|
|
4742
|
+
* Returns the duration calculated from the input.
|
|
4743
|
+
*
|
|
4744
|
+
* @param timing DateCellTimingStartsAtEndRange
|
|
4745
|
+
* @returns Minutes
|
|
4746
|
+
*/
|
|
4729
4747
|
function calculateExpectedDateCellTimingDuration(timing) {
|
|
4730
|
-
return
|
|
4748
|
+
return _calculateExpectedDateCellTimingDurationPair(timing).duration;
|
|
4749
|
+
}
|
|
4750
|
+
/**
|
|
4751
|
+
* Creates a DateCellTiming from the input timing by using calculateExpectedDateCellTimingDuration()
|
|
4752
|
+
*
|
|
4753
|
+
* @param timing DateCellTimingStartsAtEndRange
|
|
4754
|
+
* @returns DateCellTiming
|
|
4755
|
+
*/
|
|
4756
|
+
function dateCellTimingFromDateCellTimingStartsAtEndRange(timing) {
|
|
4757
|
+
const {
|
|
4758
|
+
startsAt,
|
|
4759
|
+
end,
|
|
4760
|
+
timezone
|
|
4761
|
+
} = timing;
|
|
4762
|
+
const duration = calculateExpectedDateCellTimingDuration(timing);
|
|
4763
|
+
return {
|
|
4764
|
+
startsAt,
|
|
4765
|
+
duration,
|
|
4766
|
+
end,
|
|
4767
|
+
timezone
|
|
4768
|
+
};
|
|
4731
4769
|
}
|
|
4732
4770
|
/**
|
|
4733
4771
|
* Returns the final StartsAt time.
|
|
4734
4772
|
*
|
|
4735
|
-
* @param timing
|
|
4736
|
-
* @returns
|
|
4773
|
+
* @param timing DateCellTimingStartsAtEndRange
|
|
4774
|
+
* @returns DateCellTimingEvent
|
|
4737
4775
|
*/
|
|
4738
4776
|
function dateCellTimingFinalStartsAtEvent(timing) {
|
|
4739
4777
|
const {
|
|
@@ -6087,29 +6125,6 @@ function dateCellTimingEndDateFactory(input) {
|
|
|
6087
6125
|
function getRelativeDateForDateCellTiming(timing, input) {
|
|
6088
6126
|
return dateCellTimingDateFactory(timing)(input);
|
|
6089
6127
|
}
|
|
6090
|
-
/**
|
|
6091
|
-
* Converts a DateCellTimingStartsAtEndRange to a DateCellTiming by calculating the difference in hours from the last startsAt timing and the end.
|
|
6092
|
-
*
|
|
6093
|
-
* @param dateCellTimingStartEndRange
|
|
6094
|
-
* @param event
|
|
6095
|
-
* @param timezone
|
|
6096
|
-
* @returns
|
|
6097
|
-
*/
|
|
6098
|
-
function dateCellTimingFromDateCellTimingStartsAtEndRange(dateCellTimingStartsAtEndRange) {
|
|
6099
|
-
const {
|
|
6100
|
-
startsAt,
|
|
6101
|
-
timezone,
|
|
6102
|
-
end
|
|
6103
|
-
} = dateCellTimingStartsAtEndRange;
|
|
6104
|
-
const duration = calculateExpectedDateCellTimingDuration(dateCellTimingStartsAtEndRange);
|
|
6105
|
-
const timing = {
|
|
6106
|
-
timezone,
|
|
6107
|
-
end,
|
|
6108
|
-
startsAt,
|
|
6109
|
-
duration
|
|
6110
|
-
};
|
|
6111
|
-
return timing;
|
|
6112
|
-
}
|
|
6113
6128
|
/**
|
|
6114
6129
|
* Creates a new DateCellTiming from the input configuration.
|
|
6115
6130
|
*
|
package/package.json
CHANGED
|
@@ -373,16 +373,29 @@ export interface CalculateExpectedDateCellTimingDurationPair {
|
|
|
373
373
|
/**
|
|
374
374
|
* Returns the expected duration from the input.
|
|
375
375
|
*
|
|
376
|
-
* @param timing
|
|
377
|
-
* @returns
|
|
376
|
+
* @param timing DateCellTimingStartsAtEndRange
|
|
377
|
+
* @returns CalculateExpectedDateCellTimingDurationPair
|
|
378
378
|
*/
|
|
379
379
|
export declare function calculateExpectedDateCellTimingDurationPair(timing: DateCellTimingStartsAtEndRange): CalculateExpectedDateCellTimingDurationPair;
|
|
380
|
+
/**
|
|
381
|
+
* Returns the duration calculated from the input.
|
|
382
|
+
*
|
|
383
|
+
* @param timing DateCellTimingStartsAtEndRange
|
|
384
|
+
* @returns Minutes
|
|
385
|
+
*/
|
|
380
386
|
export declare function calculateExpectedDateCellTimingDuration(timing: DateCellTimingStartsAtEndRange): Minutes;
|
|
387
|
+
/**
|
|
388
|
+
* Creates a DateCellTiming from the input timing by using calculateExpectedDateCellTimingDuration()
|
|
389
|
+
*
|
|
390
|
+
* @param timing DateCellTimingStartsAtEndRange
|
|
391
|
+
* @returns DateCellTiming
|
|
392
|
+
*/
|
|
393
|
+
export declare function dateCellTimingFromDateCellTimingStartsAtEndRange(timing: DateCellTimingStartsAtEndRange): DateCellTiming;
|
|
381
394
|
/**
|
|
382
395
|
* Returns the final StartsAt time.
|
|
383
396
|
*
|
|
384
|
-
* @param timing
|
|
385
|
-
* @returns
|
|
397
|
+
* @param timing DateCellTimingStartsAtEndRange
|
|
398
|
+
* @returns DateCellTimingEvent
|
|
386
399
|
*/
|
|
387
400
|
export declare function dateCellTimingFinalStartsAtEvent(timing: DateCellTimingStartsAtEndRange): DateCellTimingEvent;
|
|
388
401
|
export interface IsValidDateCellTimingInfo {
|
|
@@ -351,15 +351,6 @@ export declare function dateCellTimingEndDateFactory<T extends DateCellTiming =
|
|
|
351
351
|
* @param date
|
|
352
352
|
*/
|
|
353
353
|
export declare function getRelativeDateForDateCellTiming(timing: DateCellTimingStartsAt, input: DateOrDateCellIndex): Date;
|
|
354
|
-
/**
|
|
355
|
-
* Converts a DateCellTimingStartsAtEndRange to a DateCellTiming by calculating the difference in hours from the last startsAt timing and the end.
|
|
356
|
-
*
|
|
357
|
-
* @param dateCellTimingStartEndRange
|
|
358
|
-
* @param event
|
|
359
|
-
* @param timezone
|
|
360
|
-
* @returns
|
|
361
|
-
*/
|
|
362
|
-
export declare function dateCellTimingFromDateCellTimingStartsAtEndRange(dateCellTimingStartsAtEndRange: DateCellTimingStartsAtEndRange): DateCellTiming;
|
|
363
354
|
export interface UpdateDateCellTimingWithDateCellTimingEventInput {
|
|
364
355
|
/**
|
|
365
356
|
* Target timing to update.
|