@sbb-esta/lyne-elements-experimental-dev 5.1.0-dev.1783094110 → 5.1.0-dev.1783336064
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/core.js +1 -1
- package/development/core.js +124 -124
- package/development/journey-summary.pure.js +291 -291
- package/development/pearl-chain-time.pure.js +291 -291
- package/development/pearl-chain.pure.js +9 -9
- package/development/timetable-row.pure.js +291 -291
- package/journey-summary.pure.js +3 -3
- package/package.json +2 -2
- package/pearl-chain-time.pure.js +1 -1
- package/pearl-chain.pure.js +1 -1
- package/timetable-row.pure.js +2 -2
package/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i18nDurationDay as e,i18nDurationHour as t,i18nDurationMinute as n,i18nWalkingDistanceArrival as r,i18nWalkingDistanceDeparture as i}from"@sbb-esta/lyne-elements/core.js";import{html as a,nothing as o}from"lit";import"@sbb-esta/lyne-elements/icon.pure.js";const s=6e4,c=36e5,l=Symbol.for(`constructDateFrom`);function u(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&l in e?e[l](t):e instanceof Date?new e.constructor(t):new Date(t)}function d(e,t){return u(t||e,e)}function f(e,t,n){let r=d(e,n?.in);return isNaN(t)?u(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function p(e,t,n){return u(n?.in||e,+d(e)+t)}function m(e,t,n){return p(e,t*c,n)}function h(e
|
|
1
|
+
import{i18nDurationDay as e,i18nDurationHour as t,i18nDurationMinute as n,i18nWalkingDistanceArrival as r,i18nWalkingDistanceDeparture as i}from"@sbb-esta/lyne-elements/core.js";import{html as a,nothing as o}from"lit";import"@sbb-esta/lyne-elements/icon.pure.js";const s=6e4,c=36e5,l=Symbol.for(`constructDateFrom`);function u(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&l in e?e[l](t):e instanceof Date?new e.constructor(t):new Date(t)}function d(e,t){return u(t||e,e)}function f(e,t,n){let r=d(e,n?.in);return isNaN(t)?u(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function p(e,t,n){return u(n?.in||e,+d(e)+t)}function m(e,t,n){return p(e,t*c,n)}function h(e){let t=d(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function g(e,...t){let n=u.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function _(e,t){let n=d(e,t?.in);return n.setHours(0,0,0,0),n}function v(e,t,n){let[r,i]=g(n?.in,e,t),a=_(r),o=_(i),s=+a-h(a),c=+o-h(o);return Math.round((s-c)/864e5)}function y(e,t,n){let r=d(e,n?.in);return r.setTime(r.getTime()+t*s),r}function b(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function x(e){return!(!b(e)&&typeof e!=`number`||isNaN(+d(e)))}function S(e,t,n){let[r,i]=g(n?.in,e,t),a=C(r,i),o=Math.abs(v(r,i));r.setDate(r.getDate()-a*o);let s=a*(o-Number(C(r,i)===-a));return s===0?0:s}function C(e,t){let n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function w(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function T(e,t,n){let[r,i]=g(n?.in,e,t),a=(r-+i)/c;return w(n?.roundingMethod)(a)}function E(e,t){return d(e)-+d(t)}function D(e,t,n){let r=E(e,t)/s;return w(n?.roundingMethod)(r)}function O(e,t,n){return f(e,-t,n)}function k(e,t){let n=()=>u(t?.in,NaN),r=t?.additionalDigits??2,i=ne(e),a;if(i.date){let e=re(i.date,r);a=M(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,c;if(i.time&&(s=P(i.time),isNaN(s)))return n();if(i.timezone){if(c=I(i.timezone),isNaN(c))return n()}else{let e=new Date(o+s),n=d(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return d(o+s+c,t?.in)}const A={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},j=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,ee=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,te=/^([+-])(\d{2})(?::?(\d{2}))?$/;function ne(e){let t={},n=e.split(A.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],A.timeZoneDelimiter.test(t.date)&&(t.date=e.split(A.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=A.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function re(e,t){let n=RegExp(`^(?:(\\d{4}|[+-]\\d{`+(4+t)+`})|(\\d{2}|[+-]\\d{`+(2+t)+`})$)`),r=e.match(n);if(!r)return{year:NaN,restDateString:``};let i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function M(e,t){if(t===null)return new Date(NaN);let n=e.match(j);if(!n)return new Date(NaN);let r=!!n[4],i=N(n[1]),a=N(n[2])-1,o=N(n[3]),s=N(n[4]),c=N(n[5])-1;if(r)return H(t,s,c)?L(t,s,c):new Date(NaN);{let e=new Date(0);return!B(t,a,o)||!V(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function N(e){return e?parseInt(e):1}function P(e){let t=e.match(ee);if(!t)return NaN;let n=F(t[1]),r=F(t[2]),i=F(t[3]);return U(n,r,i)?n*c+r*s+i*1e3:NaN}function F(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function I(e){if(e===`Z`)return 0;let t=e.match(te);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return W(r,i)?n*(r*c+i*s):NaN}function L(e,t,n){let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}const R=[31,null,31,30,31,30,31,31,30,31,30,31];function z(e){return e%400==0||e%4==0&&e%100!=0}function B(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(R[t]||(z(e)?29:28))}function V(e,t){return t>=1&&t<=(z(e)?366:365)}function H(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function U(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function W(e,t){return t>=0&&t<=59}function G(e,t,n){return m(e,-t,n)}function K(e){if(e&&x(k(e))){if(e.includes(`Z`))return new Date(e.replace(`Z`,``));if(e.includes(`T`)){let t=e.split(`T`);if(t[1]&&(t[1].includes(`+`)||t[1].includes(`-`)))return new Date(`${t[0]}T${t[1].split(/[+-]/)[0]}`)}return new Date(e)}}const q=(r,i)=>{let a=[],o=[],s=y(0,r),c=S(s,0);c>0&&(a.push(`${c} d`),i&&o.push(`${c} ${c>1?e.multiple.long[i]:e.single.long[i]}`),s=O(s,c));let l=T(s,0);l>0&&(a.push(`${l} h`),i&&o.push(`${l} ${l>1?t.multiple.long[i]:t.single.long[i]}`),s=G(s,l));let u=D(s,0);return u>0&&(a.push(`${u} min`),i&&o.push(`${u} ${u>1?n.multiple.long[i]:n.single.long[i]}`)),{short:a.join(` `),long:o.join(` `)}},J=e=>e?.__typename===`PTRideLeg`,Y=e=>e?.__typename===`PTConnectionLeg`,X=e=>{let t=e?.text?.template&&e.text.template.indexOf(`(`)+1,n=e?.text?.template?.substring(t||0,e?.text?.template.indexOf(`)`));return{duration:n&&+n.substring(0,n.length-1)||0,text:e?.text?.template?.split(`(`)[0]||``}};function Z(e,t){let n=Y(e)?e:null,r=n?n?.notices?.filter(e=>t.includes(e.name))[0]:null;return r?{duration:n?.duration||0,text:r?.text?.template||``,icon:`walk-small`}:null}function ie(e,t,n,r){let a=J(e)?e?.serviceJourney?.notices?.filter(e=>[`CI`].includes(e.name))[0]:null,o=a&&X(a);return a?{duration:(o?.duration||0)+(t||0),text:n?i[r]:o?.text||``,icon:n?`wheelchair-small`:`sa-${a?.name?.toLowerCase()}`}:null}function ae(e,t,n,i){let a=J(e)?e?.serviceJourney?.notices?.filter(e=>[`CO`].includes(e.name))[0]:null,o=a&&X(a);return a?{duration:(o?.duration||0)+(t||0),text:n?r[i]:o?.text||``,icon:n?`wheelchair-small`:`sa-${a?.name?.toLowerCase()}`}:null}function Q(e,t,n,s,c){return a`
|
|
2
2
|
<span class="sbb-pearl-chain__time-transfer sbb-pearl-chain__time-transfer--${t}-${c}">
|
|
3
3
|
<sbb-icon name=${t}></sbb-icon>
|
|
4
4
|
<time datetime=${e+`M`}>
|
package/development/core.js
CHANGED
|
@@ -318,39 +318,6 @@ function addHours(date, amount, options) {
|
|
|
318
318
|
return addMilliseconds(date, amount * millisecondsInHour, options);
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
//#endregion
|
|
322
|
-
//#region node_modules/date-fns/addMinutes.js
|
|
323
|
-
/**
|
|
324
|
-
* The {@link addMinutes} function options.
|
|
325
|
-
*/
|
|
326
|
-
/**
|
|
327
|
-
* @name addMinutes
|
|
328
|
-
* @category Minute Helpers
|
|
329
|
-
* @summary Add the specified number of minutes to the given date.
|
|
330
|
-
*
|
|
331
|
-
* @description
|
|
332
|
-
* Add the specified number of minutes to the given date.
|
|
333
|
-
*
|
|
334
|
-
* @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).
|
|
335
|
-
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
336
|
-
*
|
|
337
|
-
* @param date - The date to be changed
|
|
338
|
-
* @param amount - The amount of minutes to be added.
|
|
339
|
-
* @param options - An object with options
|
|
340
|
-
*
|
|
341
|
-
* @returns The new date with the minutes added
|
|
342
|
-
*
|
|
343
|
-
* @example
|
|
344
|
-
* // Add 30 minutes to 10 July 2014 12:00:00:
|
|
345
|
-
* const result = addMinutes(new Date(2014, 6, 10, 12, 0), 30)
|
|
346
|
-
* //=> Thu Jul 10 2014 12:30:00
|
|
347
|
-
*/
|
|
348
|
-
function addMinutes(date, amount, options) {
|
|
349
|
-
const _date = toDate(date, options?.in);
|
|
350
|
-
_date.setTime(_date.getTime() + amount * millisecondsInMinute);
|
|
351
|
-
return _date;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
321
|
//#endregion
|
|
355
322
|
//#region node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
|
|
356
323
|
/**
|
|
@@ -456,6 +423,114 @@ function differenceInCalendarDays(laterDate, earlierDate, options) {
|
|
|
456
423
|
return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
|
|
457
424
|
}
|
|
458
425
|
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region node_modules/date-fns/addMinutes.js
|
|
428
|
+
/**
|
|
429
|
+
* The {@link addMinutes} function options.
|
|
430
|
+
*/
|
|
431
|
+
/**
|
|
432
|
+
* @name addMinutes
|
|
433
|
+
* @category Minute Helpers
|
|
434
|
+
* @summary Add the specified number of minutes to the given date.
|
|
435
|
+
*
|
|
436
|
+
* @description
|
|
437
|
+
* Add the specified number of minutes to the given date.
|
|
438
|
+
*
|
|
439
|
+
* @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).
|
|
440
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
441
|
+
*
|
|
442
|
+
* @param date - The date to be changed
|
|
443
|
+
* @param amount - The amount of minutes to be added.
|
|
444
|
+
* @param options - An object with options
|
|
445
|
+
*
|
|
446
|
+
* @returns The new date with the minutes added
|
|
447
|
+
*
|
|
448
|
+
* @example
|
|
449
|
+
* // Add 30 minutes to 10 July 2014 12:00:00:
|
|
450
|
+
* const result = addMinutes(new Date(2014, 6, 10, 12, 0), 30)
|
|
451
|
+
* //=> Thu Jul 10 2014 12:30:00
|
|
452
|
+
*/
|
|
453
|
+
function addMinutes(date, amount, options) {
|
|
454
|
+
const _date = toDate(date, options?.in);
|
|
455
|
+
_date.setTime(_date.getTime() + amount * millisecondsInMinute);
|
|
456
|
+
return _date;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
//#endregion
|
|
460
|
+
//#region node_modules/date-fns/isDate.js
|
|
461
|
+
/**
|
|
462
|
+
* @name isDate
|
|
463
|
+
* @category Common Helpers
|
|
464
|
+
* @summary Is the given value a date?
|
|
465
|
+
*
|
|
466
|
+
* @description
|
|
467
|
+
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
|
|
468
|
+
*
|
|
469
|
+
* @param value - The value to check
|
|
470
|
+
*
|
|
471
|
+
* @returns True if the given value is a date
|
|
472
|
+
*
|
|
473
|
+
* @example
|
|
474
|
+
* // For a valid date:
|
|
475
|
+
* const result = isDate(new Date())
|
|
476
|
+
* //=> true
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* // For an invalid date:
|
|
480
|
+
* const result = isDate(new Date(NaN))
|
|
481
|
+
* //=> true
|
|
482
|
+
*
|
|
483
|
+
* @example
|
|
484
|
+
* // For some value:
|
|
485
|
+
* const result = isDate('2014-02-31')
|
|
486
|
+
* //=> false
|
|
487
|
+
*
|
|
488
|
+
* @example
|
|
489
|
+
* // For an object:
|
|
490
|
+
* const result = isDate({})
|
|
491
|
+
* //=> false
|
|
492
|
+
*/
|
|
493
|
+
function isDate(value) {
|
|
494
|
+
return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region node_modules/date-fns/isValid.js
|
|
499
|
+
/**
|
|
500
|
+
* @name isValid
|
|
501
|
+
* @category Common Helpers
|
|
502
|
+
* @summary Is the given date valid?
|
|
503
|
+
*
|
|
504
|
+
* @description
|
|
505
|
+
* Returns false if argument is Invalid Date and true otherwise.
|
|
506
|
+
* Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)
|
|
507
|
+
* Invalid Date is a Date, whose time value is NaN.
|
|
508
|
+
*
|
|
509
|
+
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
510
|
+
*
|
|
511
|
+
* @param date - The date to check
|
|
512
|
+
*
|
|
513
|
+
* @returns The date is valid
|
|
514
|
+
*
|
|
515
|
+
* @example
|
|
516
|
+
* // For the valid date:
|
|
517
|
+
* const result = isValid(new Date(2014, 1, 31))
|
|
518
|
+
* //=> true
|
|
519
|
+
*
|
|
520
|
+
* @example
|
|
521
|
+
* // For the value, convertible into a date:
|
|
522
|
+
* const result = isValid(1393804800000)
|
|
523
|
+
* //=> true
|
|
524
|
+
*
|
|
525
|
+
* @example
|
|
526
|
+
* // For the invalid date:
|
|
527
|
+
* const result = isValid(new Date(''))
|
|
528
|
+
* //=> false
|
|
529
|
+
*/
|
|
530
|
+
function isValid(date) {
|
|
531
|
+
return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
|
|
532
|
+
}
|
|
533
|
+
|
|
459
534
|
//#endregion
|
|
460
535
|
//#region node_modules/date-fns/differenceInDays.js
|
|
461
536
|
/**
|
|
@@ -640,78 +715,31 @@ function differenceInMinutes(dateLeft, dateRight, options) {
|
|
|
640
715
|
}
|
|
641
716
|
|
|
642
717
|
//#endregion
|
|
643
|
-
//#region node_modules/date-fns/
|
|
718
|
+
//#region node_modules/date-fns/subDays.js
|
|
644
719
|
/**
|
|
645
|
-
* @
|
|
646
|
-
* @category Common Helpers
|
|
647
|
-
* @summary Is the given value a date?
|
|
648
|
-
*
|
|
649
|
-
* @description
|
|
650
|
-
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
|
|
651
|
-
*
|
|
652
|
-
* @param value - The value to check
|
|
653
|
-
*
|
|
654
|
-
* @returns True if the given value is a date
|
|
655
|
-
*
|
|
656
|
-
* @example
|
|
657
|
-
* // For a valid date:
|
|
658
|
-
* const result = isDate(new Date())
|
|
659
|
-
* //=> true
|
|
660
|
-
*
|
|
661
|
-
* @example
|
|
662
|
-
* // For an invalid date:
|
|
663
|
-
* const result = isDate(new Date(NaN))
|
|
664
|
-
* //=> true
|
|
665
|
-
*
|
|
666
|
-
* @example
|
|
667
|
-
* // For some value:
|
|
668
|
-
* const result = isDate('2014-02-31')
|
|
669
|
-
* //=> false
|
|
670
|
-
*
|
|
671
|
-
* @example
|
|
672
|
-
* // For an object:
|
|
673
|
-
* const result = isDate({})
|
|
674
|
-
* //=> false
|
|
720
|
+
* The {@link subDays} function options.
|
|
675
721
|
*/
|
|
676
|
-
function isDate(value) {
|
|
677
|
-
return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
//#endregion
|
|
681
|
-
//#region node_modules/date-fns/isValid.js
|
|
682
722
|
/**
|
|
683
|
-
* @name
|
|
684
|
-
* @category
|
|
685
|
-
* @summary
|
|
686
|
-
*
|
|
687
|
-
* @description
|
|
688
|
-
* Returns false if argument is Invalid Date and true otherwise.
|
|
689
|
-
* Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)
|
|
690
|
-
* Invalid Date is a Date, whose time value is NaN.
|
|
691
|
-
*
|
|
692
|
-
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
693
|
-
*
|
|
694
|
-
* @param date - The date to check
|
|
723
|
+
* @name subDays
|
|
724
|
+
* @category Day Helpers
|
|
725
|
+
* @summary Subtract the specified number of days from the given date.
|
|
695
726
|
*
|
|
696
|
-
* @
|
|
727
|
+
* @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).
|
|
728
|
+
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
697
729
|
*
|
|
698
|
-
* @
|
|
699
|
-
*
|
|
700
|
-
*
|
|
701
|
-
* //=> true
|
|
730
|
+
* @param date - The date to be changed
|
|
731
|
+
* @param amount - The amount of days to be subtracted.
|
|
732
|
+
* @param options - An object with options
|
|
702
733
|
*
|
|
703
|
-
* @
|
|
704
|
-
* // For the value, convertible into a date:
|
|
705
|
-
* const result = isValid(1393804800000)
|
|
706
|
-
* //=> true
|
|
734
|
+
* @returns The new date with the days subtracted
|
|
707
735
|
*
|
|
708
736
|
* @example
|
|
709
|
-
* //
|
|
710
|
-
* const result =
|
|
711
|
-
* //=>
|
|
737
|
+
* // Subtract 10 days from 1 September 2014:
|
|
738
|
+
* const result = subDays(new Date(2014, 8, 1), 10)
|
|
739
|
+
* //=> Fri Aug 22 2014 00:00:00
|
|
712
740
|
*/
|
|
713
|
-
function
|
|
714
|
-
return
|
|
741
|
+
function subDays(date, amount, options) {
|
|
742
|
+
return addDays(date, -amount, options);
|
|
715
743
|
}
|
|
716
744
|
|
|
717
745
|
//#endregion
|
|
@@ -913,34 +941,6 @@ function validateTimezone(_hours, minutes) {
|
|
|
913
941
|
return minutes >= 0 && minutes <= 59;
|
|
914
942
|
}
|
|
915
943
|
|
|
916
|
-
//#endregion
|
|
917
|
-
//#region node_modules/date-fns/subDays.js
|
|
918
|
-
/**
|
|
919
|
-
* The {@link subDays} function options.
|
|
920
|
-
*/
|
|
921
|
-
/**
|
|
922
|
-
* @name subDays
|
|
923
|
-
* @category Day Helpers
|
|
924
|
-
* @summary Subtract the specified number of days from the given date.
|
|
925
|
-
*
|
|
926
|
-
* @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).
|
|
927
|
-
* @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
|
928
|
-
*
|
|
929
|
-
* @param date - The date to be changed
|
|
930
|
-
* @param amount - The amount of days to be subtracted.
|
|
931
|
-
* @param options - An object with options
|
|
932
|
-
*
|
|
933
|
-
* @returns The new date with the days subtracted
|
|
934
|
-
*
|
|
935
|
-
* @example
|
|
936
|
-
* // Subtract 10 days from 1 September 2014:
|
|
937
|
-
* const result = subDays(new Date(2014, 8, 1), 10)
|
|
938
|
-
* //=> Fri Aug 22 2014 00:00:00
|
|
939
|
-
*/
|
|
940
|
-
function subDays(date, amount, options) {
|
|
941
|
-
return addDays(date, -amount, options);
|
|
942
|
-
}
|
|
943
|
-
|
|
944
944
|
//#endregion
|
|
945
945
|
//#region node_modules/date-fns/subHours.js
|
|
946
946
|
/**
|