abdul-react 0.0.13 → 0.0.14

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/lib/index.cjs CHANGED
@@ -24860,6 +24860,498 @@ function DayPicker(props) {
24860
24860
  }, props.footer))));
24861
24861
  }
24862
24862
 
24863
+ /**
24864
+ * @name toDate
24865
+ * @category Common Helpers
24866
+ * @summary Convert the given argument to an instance of Date.
24867
+ *
24868
+ * @description
24869
+ * Convert the given argument to an instance of Date.
24870
+ *
24871
+ * If the argument is an instance of Date, the function returns its clone.
24872
+ *
24873
+ * If the argument is a number, it is treated as a timestamp.
24874
+ *
24875
+ * If the argument is none of the above, the function returns Invalid Date.
24876
+ *
24877
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
24878
+ *
24879
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
24880
+ *
24881
+ * @param argument - The value to convert
24882
+ *
24883
+ * @returns The parsed date in the local time zone
24884
+ *
24885
+ * @example
24886
+ * // Clone the date:
24887
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
24888
+ * //=> Tue Feb 11 2014 11:30:30
24889
+ *
24890
+ * @example
24891
+ * // Convert the timestamp to date:
24892
+ * const result = toDate(1392098430000)
24893
+ * //=> Tue Feb 11 2014 11:30:30
24894
+ */
24895
+ function toDate$1(argument) {
24896
+ const argStr = Object.prototype.toString.call(argument);
24897
+
24898
+ // Clone the date
24899
+ if (
24900
+ argument instanceof Date ||
24901
+ (typeof argument === "object" && argStr === "[object Date]")
24902
+ ) {
24903
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
24904
+ return new argument.constructor(+argument);
24905
+ } else if (
24906
+ typeof argument === "number" ||
24907
+ argStr === "[object Number]" ||
24908
+ typeof argument === "string" ||
24909
+ argStr === "[object String]"
24910
+ ) {
24911
+ // TODO: Can we get rid of as?
24912
+ return new Date(argument);
24913
+ } else {
24914
+ // TODO: Can we get rid of as?
24915
+ return new Date(NaN);
24916
+ }
24917
+ }
24918
+
24919
+ /**
24920
+ * @name constructFrom
24921
+ * @category Generic Helpers
24922
+ * @summary Constructs a date using the reference date and the value
24923
+ *
24924
+ * @description
24925
+ * The function constructs a new date using the constructor from the reference
24926
+ * date and the given value. It helps to build generic functions that accept
24927
+ * date extensions.
24928
+ *
24929
+ * It defaults to `Date` if the passed reference date is a number or a string.
24930
+ *
24931
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
24932
+ *
24933
+ * @param date - The reference date to take constructor from
24934
+ * @param value - The value to create the date
24935
+ *
24936
+ * @returns Date initialized using the given date and value
24937
+ *
24938
+ * @example
24939
+ * import { constructFrom } from 'date-fns'
24940
+ *
24941
+ * // A function that clones a date preserving the original type
24942
+ * function cloneDate<DateType extends Date(date: DateType): DateType {
24943
+ * return constructFrom(
24944
+ * date, // Use contrustor from the given date
24945
+ * date.getTime() // Use the date value to create a new date
24946
+ * )
24947
+ * }
24948
+ */
24949
+ function constructFrom(date, value) {
24950
+ if (date instanceof Date) {
24951
+ return new date.constructor(value);
24952
+ } else {
24953
+ return new Date(value);
24954
+ }
24955
+ }
24956
+
24957
+ /**
24958
+ * @module constants
24959
+ * @summary Useful constants
24960
+ * @description
24961
+ * Collection of useful date constants.
24962
+ *
24963
+ * The constants could be imported from `date-fns/constants`:
24964
+ *
24965
+ * ```ts
24966
+ * import { maxTime, minTime } from "./constants/date-fns/constants";
24967
+ *
24968
+ * function isAllowedTime(time) {
24969
+ * return time <= maxTime && time >= minTime;
24970
+ * }
24971
+ * ```
24972
+ */
24973
+
24974
+
24975
+ /**
24976
+ * @constant
24977
+ * @name millisecondsInWeek
24978
+ * @summary Milliseconds in 1 week.
24979
+ */
24980
+ const millisecondsInWeek = 604800000;
24981
+
24982
+ /**
24983
+ * @constant
24984
+ * @name millisecondsInDay
24985
+ * @summary Milliseconds in 1 day.
24986
+ */
24987
+ const millisecondsInDay = 86400000;
24988
+
24989
+ let defaultOptions = {};
24990
+
24991
+ function getDefaultOptions$1() {
24992
+ return defaultOptions;
24993
+ }
24994
+
24995
+ /**
24996
+ * The {@link startOfWeek} function options.
24997
+ */
24998
+
24999
+ /**
25000
+ * @name startOfWeek
25001
+ * @category Week Helpers
25002
+ * @summary Return the start of a week for the given date.
25003
+ *
25004
+ * @description
25005
+ * Return the start of a week for the given date.
25006
+ * The result will be in the local timezone.
25007
+ *
25008
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25009
+ *
25010
+ * @param date - The original date
25011
+ * @param options - An object with options
25012
+ *
25013
+ * @returns The start of a week
25014
+ *
25015
+ * @example
25016
+ * // The start of a week for 2 September 2014 11:55:00:
25017
+ * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
25018
+ * //=> Sun Aug 31 2014 00:00:00
25019
+ *
25020
+ * @example
25021
+ * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
25022
+ * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
25023
+ * //=> Mon Sep 01 2014 00:00:00
25024
+ */
25025
+ function startOfWeek(date, options) {
25026
+ const defaultOptions = getDefaultOptions$1();
25027
+ const weekStartsOn =
25028
+ options?.weekStartsOn ??
25029
+ options?.locale?.options?.weekStartsOn ??
25030
+ defaultOptions.weekStartsOn ??
25031
+ defaultOptions.locale?.options?.weekStartsOn ??
25032
+ 0;
25033
+
25034
+ const _date = toDate$1(date);
25035
+ const day = _date.getDay();
25036
+ const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
25037
+
25038
+ _date.setDate(_date.getDate() - diff);
25039
+ _date.setHours(0, 0, 0, 0);
25040
+ return _date;
25041
+ }
25042
+
25043
+ /**
25044
+ * @name startOfISOWeek
25045
+ * @category ISO Week Helpers
25046
+ * @summary Return the start of an ISO week for the given date.
25047
+ *
25048
+ * @description
25049
+ * Return the start of an ISO week for the given date.
25050
+ * The result will be in the local timezone.
25051
+ *
25052
+ * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
25053
+ *
25054
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25055
+ *
25056
+ * @param date - The original date
25057
+ *
25058
+ * @returns The start of an ISO week
25059
+ *
25060
+ * @example
25061
+ * // The start of an ISO week for 2 September 2014 11:55:00:
25062
+ * const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
25063
+ * //=> Mon Sep 01 2014 00:00:00
25064
+ */
25065
+ function startOfISOWeek(date) {
25066
+ return startOfWeek(date, { weekStartsOn: 1 });
25067
+ }
25068
+
25069
+ /**
25070
+ * @name getISOWeekYear
25071
+ * @category ISO Week-Numbering Year Helpers
25072
+ * @summary Get the ISO week-numbering year of the given date.
25073
+ *
25074
+ * @description
25075
+ * Get the ISO week-numbering year of the given date,
25076
+ * which always starts 3 days before the year's first Thursday.
25077
+ *
25078
+ * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
25079
+ *
25080
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25081
+ *
25082
+ * @param date - The given date
25083
+ *
25084
+ * @returns The ISO week-numbering year
25085
+ *
25086
+ * @example
25087
+ * // Which ISO-week numbering year is 2 January 2005?
25088
+ * const result = getISOWeekYear(new Date(2005, 0, 2))
25089
+ * //=> 2004
25090
+ */
25091
+ function getISOWeekYear(date) {
25092
+ const _date = toDate$1(date);
25093
+ const year = _date.getFullYear();
25094
+
25095
+ const fourthOfJanuaryOfNextYear = constructFrom(date, 0);
25096
+ fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
25097
+ fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
25098
+ const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
25099
+
25100
+ const fourthOfJanuaryOfThisYear = constructFrom(date, 0);
25101
+ fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
25102
+ fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
25103
+ const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
25104
+
25105
+ if (_date.getTime() >= startOfNextYear.getTime()) {
25106
+ return year + 1;
25107
+ } else if (_date.getTime() >= startOfThisYear.getTime()) {
25108
+ return year;
25109
+ } else {
25110
+ return year - 1;
25111
+ }
25112
+ }
25113
+
25114
+ /**
25115
+ * @name startOfDay
25116
+ * @category Day Helpers
25117
+ * @summary Return the start of a day for the given date.
25118
+ *
25119
+ * @description
25120
+ * Return the start of a day for the given date.
25121
+ * The result will be in the local timezone.
25122
+ *
25123
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25124
+ *
25125
+ * @param date - The original date
25126
+ *
25127
+ * @returns The start of a day
25128
+ *
25129
+ * @example
25130
+ * // The start of a day for 2 September 2014 11:55:00:
25131
+ * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
25132
+ * //=> Tue Sep 02 2014 00:00:00
25133
+ */
25134
+ function startOfDay(date) {
25135
+ const _date = toDate$1(date);
25136
+ _date.setHours(0, 0, 0, 0);
25137
+ return _date;
25138
+ }
25139
+
25140
+ /**
25141
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
25142
+ * They usually appear for dates that denote time before the timezones were introduced
25143
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
25144
+ * and GMT+01:00:00 after that date)
25145
+ *
25146
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
25147
+ * which would lead to incorrect calculations.
25148
+ *
25149
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
25150
+ */
25151
+ function getTimezoneOffsetInMilliseconds$1(date) {
25152
+ const _date = toDate$1(date);
25153
+ const utcDate = new Date(
25154
+ Date.UTC(
25155
+ _date.getFullYear(),
25156
+ _date.getMonth(),
25157
+ _date.getDate(),
25158
+ _date.getHours(),
25159
+ _date.getMinutes(),
25160
+ _date.getSeconds(),
25161
+ _date.getMilliseconds(),
25162
+ ),
25163
+ );
25164
+ utcDate.setUTCFullYear(_date.getFullYear());
25165
+ return +date - +utcDate;
25166
+ }
25167
+
25168
+ /**
25169
+ * @name differenceInCalendarDays
25170
+ * @category Day Helpers
25171
+ * @summary Get the number of calendar days between the given dates.
25172
+ *
25173
+ * @description
25174
+ * Get the number of calendar days between the given dates. This means that the times are removed
25175
+ * from the dates and then the difference in days is calculated.
25176
+ *
25177
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25178
+ *
25179
+ * @param dateLeft - The later date
25180
+ * @param dateRight - The earlier date
25181
+ *
25182
+ * @returns The number of calendar days
25183
+ *
25184
+ * @example
25185
+ * // How many calendar days are between
25186
+ * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
25187
+ * const result = differenceInCalendarDays(
25188
+ * new Date(2012, 6, 2, 0, 0),
25189
+ * new Date(2011, 6, 2, 23, 0)
25190
+ * )
25191
+ * //=> 366
25192
+ * // How many calendar days are between
25193
+ * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
25194
+ * const result = differenceInCalendarDays(
25195
+ * new Date(2011, 6, 3, 0, 1),
25196
+ * new Date(2011, 6, 2, 23, 59)
25197
+ * )
25198
+ * //=> 1
25199
+ */
25200
+ function differenceInCalendarDays(dateLeft, dateRight) {
25201
+ const startOfDayLeft = startOfDay(dateLeft);
25202
+ const startOfDayRight = startOfDay(dateRight);
25203
+
25204
+ const timestampLeft =
25205
+ +startOfDayLeft - getTimezoneOffsetInMilliseconds$1(startOfDayLeft);
25206
+ const timestampRight =
25207
+ +startOfDayRight - getTimezoneOffsetInMilliseconds$1(startOfDayRight);
25208
+
25209
+ // Round the number of days to the nearest integer because the number of
25210
+ // milliseconds in a day is not constant (e.g. it's different in the week of
25211
+ // the daylight saving time clock shift).
25212
+ return Math.round((timestampLeft - timestampRight) / millisecondsInDay);
25213
+ }
25214
+
25215
+ /**
25216
+ * @name startOfISOWeekYear
25217
+ * @category ISO Week-Numbering Year Helpers
25218
+ * @summary Return the start of an ISO week-numbering year for the given date.
25219
+ *
25220
+ * @description
25221
+ * Return the start of an ISO week-numbering year,
25222
+ * which always starts 3 days before the year's first Thursday.
25223
+ * The result will be in the local timezone.
25224
+ *
25225
+ * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
25226
+ *
25227
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25228
+ *
25229
+ * @param date - The original date
25230
+ *
25231
+ * @returns The start of an ISO week-numbering year
25232
+ *
25233
+ * @example
25234
+ * // The start of an ISO week-numbering year for 2 July 2005:
25235
+ * const result = startOfISOWeekYear(new Date(2005, 6, 2))
25236
+ * //=> Mon Jan 03 2005 00:00:00
25237
+ */
25238
+ function startOfISOWeekYear(date) {
25239
+ const year = getISOWeekYear(date);
25240
+ const fourthOfJanuary = constructFrom(date, 0);
25241
+ fourthOfJanuary.setFullYear(year, 0, 4);
25242
+ fourthOfJanuary.setHours(0, 0, 0, 0);
25243
+ return startOfISOWeek(fourthOfJanuary);
25244
+ }
25245
+
25246
+ /**
25247
+ * @name isDate
25248
+ * @category Common Helpers
25249
+ * @summary Is the given value a date?
25250
+ *
25251
+ * @description
25252
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
25253
+ *
25254
+ * @param value - The value to check
25255
+ *
25256
+ * @returns True if the given value is a date
25257
+ *
25258
+ * @example
25259
+ * // For a valid date:
25260
+ * const result = isDate(new Date())
25261
+ * //=> true
25262
+ *
25263
+ * @example
25264
+ * // For an invalid date:
25265
+ * const result = isDate(new Date(NaN))
25266
+ * //=> true
25267
+ *
25268
+ * @example
25269
+ * // For some value:
25270
+ * const result = isDate('2014-02-31')
25271
+ * //=> false
25272
+ *
25273
+ * @example
25274
+ * // For an object:
25275
+ * const result = isDate({})
25276
+ * //=> false
25277
+ */
25278
+ function isDate(value) {
25279
+ return (
25280
+ value instanceof Date ||
25281
+ (typeof value === "object" &&
25282
+ Object.prototype.toString.call(value) === "[object Date]")
25283
+ );
25284
+ }
25285
+
25286
+ /**
25287
+ * @name isValid
25288
+ * @category Common Helpers
25289
+ * @summary Is the given date valid?
25290
+ *
25291
+ * @description
25292
+ * Returns false if argument is Invalid Date and true otherwise.
25293
+ * Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)
25294
+ * Invalid Date is a Date, whose time value is NaN.
25295
+ *
25296
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
25297
+ *
25298
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25299
+ *
25300
+ * @param date - The date to check
25301
+ *
25302
+ * @returns The date is valid
25303
+ *
25304
+ * @example
25305
+ * // For the valid date:
25306
+ * const result = isValid(new Date(2014, 1, 31))
25307
+ * //=> true
25308
+ *
25309
+ * @example
25310
+ * // For the value, convertable into a date:
25311
+ * const result = isValid(1393804800000)
25312
+ * //=> true
25313
+ *
25314
+ * @example
25315
+ * // For the invalid date:
25316
+ * const result = isValid(new Date(''))
25317
+ * //=> false
25318
+ */
25319
+ function isValid(date) {
25320
+ if (!isDate(date) && typeof date !== "number") {
25321
+ return false;
25322
+ }
25323
+ const _date = toDate$1(date);
25324
+ return !isNaN(Number(_date));
25325
+ }
25326
+
25327
+ /**
25328
+ * @name startOfYear
25329
+ * @category Year Helpers
25330
+ * @summary Return the start of a year for the given date.
25331
+ *
25332
+ * @description
25333
+ * Return the start of a year for the given date.
25334
+ * The result will be in the local timezone.
25335
+ *
25336
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25337
+ *
25338
+ * @param date - The original date
25339
+ *
25340
+ * @returns The start of a year
25341
+ *
25342
+ * @example
25343
+ * // The start of a year for 2 September 2014 11:55:00:
25344
+ * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))
25345
+ * //=> Wed Jan 01 2014 00:00:00
25346
+ */
25347
+ function startOfYear(date) {
25348
+ const cleanDate = toDate$1(date);
25349
+ const _date = constructFrom(date, 0);
25350
+ _date.setFullYear(cleanDate.getFullYear(), 0, 1);
25351
+ _date.setHours(0, 0, 0, 0);
25352
+ return _date;
25353
+ }
25354
+
24863
25355
  const formatDistanceLocale = {
24864
25356
  lessThanXSeconds: {
24865
25357
  one: "less than a second",
@@ -25502,267 +25994,6 @@ const enUS = {
25502
25994
  },
25503
25995
  };
25504
25996
 
25505
- let defaultOptions = {};
25506
-
25507
- function getDefaultOptions$1() {
25508
- return defaultOptions;
25509
- }
25510
-
25511
- /**
25512
- * @module constants
25513
- * @summary Useful constants
25514
- * @description
25515
- * Collection of useful date constants.
25516
- *
25517
- * The constants could be imported from `date-fns/constants`:
25518
- *
25519
- * ```ts
25520
- * import { maxTime, minTime } from "./constants/date-fns/constants";
25521
- *
25522
- * function isAllowedTime(time) {
25523
- * return time <= maxTime && time >= minTime;
25524
- * }
25525
- * ```
25526
- */
25527
-
25528
-
25529
- /**
25530
- * @constant
25531
- * @name millisecondsInWeek
25532
- * @summary Milliseconds in 1 week.
25533
- */
25534
- const millisecondsInWeek = 604800000;
25535
-
25536
- /**
25537
- * @constant
25538
- * @name millisecondsInDay
25539
- * @summary Milliseconds in 1 day.
25540
- */
25541
- const millisecondsInDay = 86400000;
25542
-
25543
- /**
25544
- * @name toDate
25545
- * @category Common Helpers
25546
- * @summary Convert the given argument to an instance of Date.
25547
- *
25548
- * @description
25549
- * Convert the given argument to an instance of Date.
25550
- *
25551
- * If the argument is an instance of Date, the function returns its clone.
25552
- *
25553
- * If the argument is a number, it is treated as a timestamp.
25554
- *
25555
- * If the argument is none of the above, the function returns Invalid Date.
25556
- *
25557
- * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
25558
- *
25559
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25560
- *
25561
- * @param argument - The value to convert
25562
- *
25563
- * @returns The parsed date in the local time zone
25564
- *
25565
- * @example
25566
- * // Clone the date:
25567
- * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
25568
- * //=> Tue Feb 11 2014 11:30:30
25569
- *
25570
- * @example
25571
- * // Convert the timestamp to date:
25572
- * const result = toDate(1392098430000)
25573
- * //=> Tue Feb 11 2014 11:30:30
25574
- */
25575
- function toDate$1(argument) {
25576
- const argStr = Object.prototype.toString.call(argument);
25577
-
25578
- // Clone the date
25579
- if (
25580
- argument instanceof Date ||
25581
- (typeof argument === "object" && argStr === "[object Date]")
25582
- ) {
25583
- // Prevent the date to lose the milliseconds when passed to new Date() in IE10
25584
- return new argument.constructor(+argument);
25585
- } else if (
25586
- typeof argument === "number" ||
25587
- argStr === "[object Number]" ||
25588
- typeof argument === "string" ||
25589
- argStr === "[object String]"
25590
- ) {
25591
- // TODO: Can we get rid of as?
25592
- return new Date(argument);
25593
- } else {
25594
- // TODO: Can we get rid of as?
25595
- return new Date(NaN);
25596
- }
25597
- }
25598
-
25599
- /**
25600
- * @name startOfDay
25601
- * @category Day Helpers
25602
- * @summary Return the start of a day for the given date.
25603
- *
25604
- * @description
25605
- * Return the start of a day for the given date.
25606
- * The result will be in the local timezone.
25607
- *
25608
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25609
- *
25610
- * @param date - The original date
25611
- *
25612
- * @returns The start of a day
25613
- *
25614
- * @example
25615
- * // The start of a day for 2 September 2014 11:55:00:
25616
- * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
25617
- * //=> Tue Sep 02 2014 00:00:00
25618
- */
25619
- function startOfDay(date) {
25620
- const _date = toDate$1(date);
25621
- _date.setHours(0, 0, 0, 0);
25622
- return _date;
25623
- }
25624
-
25625
- /**
25626
- * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
25627
- * They usually appear for dates that denote time before the timezones were introduced
25628
- * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
25629
- * and GMT+01:00:00 after that date)
25630
- *
25631
- * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
25632
- * which would lead to incorrect calculations.
25633
- *
25634
- * This function returns the timezone offset in milliseconds that takes seconds in account.
25635
- */
25636
- function getTimezoneOffsetInMilliseconds$1(date) {
25637
- const _date = toDate$1(date);
25638
- const utcDate = new Date(
25639
- Date.UTC(
25640
- _date.getFullYear(),
25641
- _date.getMonth(),
25642
- _date.getDate(),
25643
- _date.getHours(),
25644
- _date.getMinutes(),
25645
- _date.getSeconds(),
25646
- _date.getMilliseconds(),
25647
- ),
25648
- );
25649
- utcDate.setUTCFullYear(_date.getFullYear());
25650
- return +date - +utcDate;
25651
- }
25652
-
25653
- /**
25654
- * @name differenceInCalendarDays
25655
- * @category Day Helpers
25656
- * @summary Get the number of calendar days between the given dates.
25657
- *
25658
- * @description
25659
- * Get the number of calendar days between the given dates. This means that the times are removed
25660
- * from the dates and then the difference in days is calculated.
25661
- *
25662
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25663
- *
25664
- * @param dateLeft - The later date
25665
- * @param dateRight - The earlier date
25666
- *
25667
- * @returns The number of calendar days
25668
- *
25669
- * @example
25670
- * // How many calendar days are between
25671
- * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
25672
- * const result = differenceInCalendarDays(
25673
- * new Date(2012, 6, 2, 0, 0),
25674
- * new Date(2011, 6, 2, 23, 0)
25675
- * )
25676
- * //=> 366
25677
- * // How many calendar days are between
25678
- * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
25679
- * const result = differenceInCalendarDays(
25680
- * new Date(2011, 6, 3, 0, 1),
25681
- * new Date(2011, 6, 2, 23, 59)
25682
- * )
25683
- * //=> 1
25684
- */
25685
- function differenceInCalendarDays(dateLeft, dateRight) {
25686
- const startOfDayLeft = startOfDay(dateLeft);
25687
- const startOfDayRight = startOfDay(dateRight);
25688
-
25689
- const timestampLeft =
25690
- +startOfDayLeft - getTimezoneOffsetInMilliseconds$1(startOfDayLeft);
25691
- const timestampRight =
25692
- +startOfDayRight - getTimezoneOffsetInMilliseconds$1(startOfDayRight);
25693
-
25694
- // Round the number of days to the nearest integer because the number of
25695
- // milliseconds in a day is not constant (e.g. it's different in the week of
25696
- // the daylight saving time clock shift).
25697
- return Math.round((timestampLeft - timestampRight) / millisecondsInDay);
25698
- }
25699
-
25700
- /**
25701
- * @name constructFrom
25702
- * @category Generic Helpers
25703
- * @summary Constructs a date using the reference date and the value
25704
- *
25705
- * @description
25706
- * The function constructs a new date using the constructor from the reference
25707
- * date and the given value. It helps to build generic functions that accept
25708
- * date extensions.
25709
- *
25710
- * It defaults to `Date` if the passed reference date is a number or a string.
25711
- *
25712
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25713
- *
25714
- * @param date - The reference date to take constructor from
25715
- * @param value - The value to create the date
25716
- *
25717
- * @returns Date initialized using the given date and value
25718
- *
25719
- * @example
25720
- * import { constructFrom } from 'date-fns'
25721
- *
25722
- * // A function that clones a date preserving the original type
25723
- * function cloneDate<DateType extends Date(date: DateType): DateType {
25724
- * return constructFrom(
25725
- * date, // Use contrustor from the given date
25726
- * date.getTime() // Use the date value to create a new date
25727
- * )
25728
- * }
25729
- */
25730
- function constructFrom(date, value) {
25731
- if (date instanceof Date) {
25732
- return new date.constructor(value);
25733
- } else {
25734
- return new Date(value);
25735
- }
25736
- }
25737
-
25738
- /**
25739
- * @name startOfYear
25740
- * @category Year Helpers
25741
- * @summary Return the start of a year for the given date.
25742
- *
25743
- * @description
25744
- * Return the start of a year for the given date.
25745
- * The result will be in the local timezone.
25746
- *
25747
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25748
- *
25749
- * @param date - The original date
25750
- *
25751
- * @returns The start of a year
25752
- *
25753
- * @example
25754
- * // The start of a year for 2 September 2014 11:55:00:
25755
- * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))
25756
- * //=> Wed Jan 01 2014 00:00:00
25757
- */
25758
- function startOfYear(date) {
25759
- const cleanDate = toDate$1(date);
25760
- const _date = constructFrom(date, 0);
25761
- _date.setFullYear(cleanDate.getFullYear(), 0, 1);
25762
- _date.setHours(0, 0, 0, 0);
25763
- return _date;
25764
- }
25765
-
25766
25997
  /**
25767
25998
  * @name getDayOfYear
25768
25999
  * @category Day Helpers
@@ -25789,156 +26020,6 @@ function getDayOfYear(date) {
25789
26020
  return dayOfYear;
25790
26021
  }
25791
26022
 
25792
- /**
25793
- * The {@link startOfWeek} function options.
25794
- */
25795
-
25796
- /**
25797
- * @name startOfWeek
25798
- * @category Week Helpers
25799
- * @summary Return the start of a week for the given date.
25800
- *
25801
- * @description
25802
- * Return the start of a week for the given date.
25803
- * The result will be in the local timezone.
25804
- *
25805
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25806
- *
25807
- * @param date - The original date
25808
- * @param options - An object with options
25809
- *
25810
- * @returns The start of a week
25811
- *
25812
- * @example
25813
- * // The start of a week for 2 September 2014 11:55:00:
25814
- * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
25815
- * //=> Sun Aug 31 2014 00:00:00
25816
- *
25817
- * @example
25818
- * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
25819
- * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
25820
- * //=> Mon Sep 01 2014 00:00:00
25821
- */
25822
- function startOfWeek(date, options) {
25823
- const defaultOptions = getDefaultOptions$1();
25824
- const weekStartsOn =
25825
- options?.weekStartsOn ??
25826
- options?.locale?.options?.weekStartsOn ??
25827
- defaultOptions.weekStartsOn ??
25828
- defaultOptions.locale?.options?.weekStartsOn ??
25829
- 0;
25830
-
25831
- const _date = toDate$1(date);
25832
- const day = _date.getDay();
25833
- const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
25834
-
25835
- _date.setDate(_date.getDate() - diff);
25836
- _date.setHours(0, 0, 0, 0);
25837
- return _date;
25838
- }
25839
-
25840
- /**
25841
- * @name startOfISOWeek
25842
- * @category ISO Week Helpers
25843
- * @summary Return the start of an ISO week for the given date.
25844
- *
25845
- * @description
25846
- * Return the start of an ISO week for the given date.
25847
- * The result will be in the local timezone.
25848
- *
25849
- * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
25850
- *
25851
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25852
- *
25853
- * @param date - The original date
25854
- *
25855
- * @returns The start of an ISO week
25856
- *
25857
- * @example
25858
- * // The start of an ISO week for 2 September 2014 11:55:00:
25859
- * const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
25860
- * //=> Mon Sep 01 2014 00:00:00
25861
- */
25862
- function startOfISOWeek(date) {
25863
- return startOfWeek(date, { weekStartsOn: 1 });
25864
- }
25865
-
25866
- /**
25867
- * @name getISOWeekYear
25868
- * @category ISO Week-Numbering Year Helpers
25869
- * @summary Get the ISO week-numbering year of the given date.
25870
- *
25871
- * @description
25872
- * Get the ISO week-numbering year of the given date,
25873
- * which always starts 3 days before the year's first Thursday.
25874
- *
25875
- * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
25876
- *
25877
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25878
- *
25879
- * @param date - The given date
25880
- *
25881
- * @returns The ISO week-numbering year
25882
- *
25883
- * @example
25884
- * // Which ISO-week numbering year is 2 January 2005?
25885
- * const result = getISOWeekYear(new Date(2005, 0, 2))
25886
- * //=> 2004
25887
- */
25888
- function getISOWeekYear(date) {
25889
- const _date = toDate$1(date);
25890
- const year = _date.getFullYear();
25891
-
25892
- const fourthOfJanuaryOfNextYear = constructFrom(date, 0);
25893
- fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
25894
- fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
25895
- const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
25896
-
25897
- const fourthOfJanuaryOfThisYear = constructFrom(date, 0);
25898
- fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
25899
- fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
25900
- const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
25901
-
25902
- if (_date.getTime() >= startOfNextYear.getTime()) {
25903
- return year + 1;
25904
- } else if (_date.getTime() >= startOfThisYear.getTime()) {
25905
- return year;
25906
- } else {
25907
- return year - 1;
25908
- }
25909
- }
25910
-
25911
- /**
25912
- * @name startOfISOWeekYear
25913
- * @category ISO Week-Numbering Year Helpers
25914
- * @summary Return the start of an ISO week-numbering year for the given date.
25915
- *
25916
- * @description
25917
- * Return the start of an ISO week-numbering year,
25918
- * which always starts 3 days before the year's first Thursday.
25919
- * The result will be in the local timezone.
25920
- *
25921
- * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
25922
- *
25923
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
25924
- *
25925
- * @param date - The original date
25926
- *
25927
- * @returns The start of an ISO week-numbering year
25928
- *
25929
- * @example
25930
- * // The start of an ISO week-numbering year for 2 July 2005:
25931
- * const result = startOfISOWeekYear(new Date(2005, 6, 2))
25932
- * //=> Mon Jan 03 2005 00:00:00
25933
- */
25934
- function startOfISOWeekYear(date) {
25935
- const year = getISOWeekYear(date);
25936
- const fourthOfJanuary = constructFrom(date, 0);
25937
- fourthOfJanuary.setFullYear(year, 0, 4);
25938
- fourthOfJanuary.setHours(0, 0, 0, 0);
25939
- return startOfISOWeek(fourthOfJanuary);
25940
- }
25941
-
25942
26023
  /**
25943
26024
  * @name getISOWeek
25944
26025
  * @category ISO Week Helpers
@@ -27102,87 +27183,6 @@ function message(token, format, input) {
27102
27183
  return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
27103
27184
  }
27104
27185
 
27105
- /**
27106
- * @name isDate
27107
- * @category Common Helpers
27108
- * @summary Is the given value a date?
27109
- *
27110
- * @description
27111
- * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
27112
- *
27113
- * @param value - The value to check
27114
- *
27115
- * @returns True if the given value is a date
27116
- *
27117
- * @example
27118
- * // For a valid date:
27119
- * const result = isDate(new Date())
27120
- * //=> true
27121
- *
27122
- * @example
27123
- * // For an invalid date:
27124
- * const result = isDate(new Date(NaN))
27125
- * //=> true
27126
- *
27127
- * @example
27128
- * // For some value:
27129
- * const result = isDate('2014-02-31')
27130
- * //=> false
27131
- *
27132
- * @example
27133
- * // For an object:
27134
- * const result = isDate({})
27135
- * //=> false
27136
- */
27137
- function isDate(value) {
27138
- return (
27139
- value instanceof Date ||
27140
- (typeof value === "object" &&
27141
- Object.prototype.toString.call(value) === "[object Date]")
27142
- );
27143
- }
27144
-
27145
- /**
27146
- * @name isValid
27147
- * @category Common Helpers
27148
- * @summary Is the given date valid?
27149
- *
27150
- * @description
27151
- * Returns false if argument is Invalid Date and true otherwise.
27152
- * Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)
27153
- * Invalid Date is a Date, whose time value is NaN.
27154
- *
27155
- * Time value of Date: http://es5.github.io/#x15.9.1.1
27156
- *
27157
- * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
27158
- *
27159
- * @param date - The date to check
27160
- *
27161
- * @returns The date is valid
27162
- *
27163
- * @example
27164
- * // For the valid date:
27165
- * const result = isValid(new Date(2014, 1, 31))
27166
- * //=> true
27167
- *
27168
- * @example
27169
- * // For the value, convertable into a date:
27170
- * const result = isValid(1393804800000)
27171
- * //=> true
27172
- *
27173
- * @example
27174
- * // For the invalid date:
27175
- * const result = isValid(new Date(''))
27176
- * //=> false
27177
- */
27178
- function isValid(date) {
27179
- if (!isDate(date) && typeof date !== "number") {
27180
- return false;
27181
- }
27182
- const _date = toDate$1(date);
27183
- return !isNaN(Number(_date));
27184
- }
27185
-
27186
27186
  // This RegExp consists of three parts separated by `|`:
27187
27187
  // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
27188
27188
  // (one of the certain letters followed by `o`)
@@ -28691,6 +28691,40 @@ function format$2(date, formatStr, options = {}) {
28691
28691
  return format$3(date, formatStr, options);
28692
28692
  }
28693
28693
 
28694
+ /**
28695
+ * @name toZonedTime
28696
+ * @category Time Zone Helpers
28697
+ * @summary Get a date/time representing local time in a given time zone from the UTC date
28698
+ *
28699
+ * @description
28700
+ * Returns a date instance with values representing the local time in the time zone
28701
+ * specified of the UTC time from the date provided. In other words, when the new date
28702
+ * is formatted it will show the equivalent hours in the target time zone regardless
28703
+ * of the current system time zone.
28704
+ *
28705
+ * @param date the date with the relevant UTC time
28706
+ * @param timeZone the time zone to get local time for, can be an offset or IANA time zone
28707
+ * @param options the object with options. See [Options]{@link https://date-fns.org/docs/Options}
28708
+ * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
28709
+ *
28710
+ * @throws {TypeError} 2 arguments required
28711
+ * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
28712
+ *
28713
+ * @example
28714
+ * // In June 10am UTC is 6am in New York (-04:00)
28715
+ * const result = toZonedTime('2014-06-25T10:00:00.000Z', 'America/New_York')
28716
+ * //=> Jun 25 2014 06:00:00
28717
+ */
28718
+ function toZonedTime(date, timeZone, options) {
28719
+ date = toDate(date, options);
28720
+ const offsetMilliseconds = tzParseTimezone(timeZone, date, true);
28721
+ const d = new Date(date.getTime() - offsetMilliseconds);
28722
+ const resultDate = new Date(0);
28723
+ resultDate.setFullYear(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());
28724
+ resultDate.setHours(d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds());
28725
+ return resultDate;
28726
+ }
28727
+
28694
28728
  const TimePicker = ({
28695
28729
  value,
28696
28730
  onChange,
@@ -28978,21 +29012,7 @@ const TimePicker = ({
28978
29012
  });
28979
29013
  };
28980
29014
 
28981
- const handleTimeZoneChange = timeZone => {
28982
- const currentDate = new Date();
28983
- return new Intl.DateTimeFormat('en-US', {
28984
- timeZone,
28985
- weekday: 'long',
28986
- year: 'numeric',
28987
- month: 'short',
28988
- day: '2-digit',
28989
- hour: '2-digit',
28990
- minute: '2-digit',
28991
- second: '2-digit',
28992
- hour12: true
28993
- }).format(currentDate);
28994
- };
28995
-
29015
+ // import { handleTimeZoneChange } from '../../utils/timeZoneChange/handleTimeZoneChange';
28996
29016
  const CustomDatePicker = /*#__PURE__*/React.forwardRef(({
28997
29017
  minDate,
28998
29018
  maxDate,
@@ -29031,7 +29051,8 @@ const CustomDatePicker = /*#__PURE__*/React.forwardRef(({
29031
29051
  const pickerRef = React.useRef(null); // Ref to track the picker
29032
29052
  const containerRef = React.useRef(null);
29033
29053
  const mergedRef = useMergeRefs(pickerRef, ref);
29034
- const todayInTimeZone = new Date(handleTimeZoneChange(timezone));
29054
+ const todayInTimeZone = startOfDay(toZonedTime(new Date(), timezone));
29055
+ const systemTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
29035
29056
  React.useEffect(() => {
29036
29057
  selectedDateRef.current = selectedDate;
29037
29058
  }, [selectedDate]);
@@ -29375,7 +29396,7 @@ const CustomDatePicker = /*#__PURE__*/React.forwardRef(({
29375
29396
  before: new Date(minDate ? minDate : ''),
29376
29397
  after: new Date(maxDate ? maxDate : '')
29377
29398
  }],
29378
- timeZone: timezone,
29399
+ timeZone: systemTimeZone,
29379
29400
  components: {
29380
29401
  CaptionLabel: props => jsxRuntime.jsx(CustomCaption, {
29381
29402
  ...props
@@ -36956,7 +36977,7 @@ const EmptyCell = {
36956
36977
  };
36957
36978
  const fontFamilyList = [{
36958
36979
  label: 'Times New Roman',
36959
- value: '"Times New Roman"'
36980
+ value: 'Times New Roman'
36960
36981
  }, {
36961
36982
  label: 'Arial',
36962
36983
  value: 'Arial'
@@ -36980,28 +37001,28 @@ const fontFamilyList = [{
36980
37001
  value: 'Tahoma'
36981
37002
  }, {
36982
37003
  label: 'Trebuchet MS',
36983
- value: '"Trebuchet MS"'
37004
+ value: 'Trebuchet MS'
36984
37005
  }, {
36985
37006
  label: 'Comic Sans MS',
36986
- value: '"Comic Sans MS"'
37007
+ value: 'Comic Sans MS'
36987
37008
  }, {
36988
37009
  label: 'Impact',
36989
37010
  value: 'Impact'
36990
37011
  }, {
36991
37012
  label: 'Arial Black',
36992
- value: '"Arial Black"'
37013
+ value: 'Arial Black'
36993
37014
  }, {
36994
37015
  label: 'Lucida Console',
36995
- value: '"Lucida Console"'
37016
+ value: 'Lucida Console'
36996
37017
  }, {
36997
37018
  label: 'Lucida Sans Unicode',
36998
- value: '"Lucida Sans Unicode"'
37019
+ value: 'Lucida Sans Unicode'
36999
37020
  }, {
37000
37021
  label: 'Courier',
37001
37022
  value: 'Courier'
37002
37023
  }, {
37003
37024
  label: 'Arial Rounded MT Bold',
37004
- value: '"Arial Rounded MT Bold"'
37025
+ value: 'Arial Rounded MT Bold'
37005
37026
  }, {
37006
37027
  label: 'Georgia',
37007
37028
  value: 'Georgia'
@@ -78241,6 +78262,21 @@ const convertToISO = dateString => {
78241
78262
  return new Date(`${formattedDate}T${formattedTime}`);
78242
78263
  };
78243
78264
 
78265
+ const handleTimeZoneChange = timeZone => {
78266
+ const currentDate = new Date();
78267
+ return new Intl.DateTimeFormat('en-US', {
78268
+ timeZone,
78269
+ weekday: 'long',
78270
+ year: 'numeric',
78271
+ month: 'short',
78272
+ day: '2-digit',
78273
+ hour: '2-digit',
78274
+ minute: '2-digit',
78275
+ second: '2-digit',
78276
+ hour12: true
78277
+ }).format(currentDate);
78278
+ };
78279
+
78244
78280
  const PrePostStepAccordions = ({
78245
78281
  data,
78246
78282
  level = 0,