@transferwise/components 0.0.0-experimental-6809bdd → 0.0.0-experimental-e153d25

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/build/index.mjs CHANGED
@@ -3323,6 +3323,9 @@ class DayCalendarTable extends PureComponent {
3323
3323
  onSelect(new Date(viewYear, viewMonth, day));
3324
3324
  };
3325
3325
  isDisabled = day => {
3326
+ if (day === -1) {
3327
+ return true;
3328
+ }
3326
3329
  const {
3327
3330
  min,
3328
3331
  max,
@@ -3338,7 +3341,7 @@ class DayCalendarTable extends PureComponent {
3338
3341
  viewMonth,
3339
3342
  viewYear
3340
3343
  } = this.props;
3341
- return !!(selectedDate && +new Date(viewYear, viewMonth, day) === +selectedDate);
3344
+ return !!(selectedDate && Number(new Date(viewYear, viewMonth, day)) === Number(selectedDate));
3342
3345
  };
3343
3346
  isToday = day => {
3344
3347
  const {
@@ -3732,8 +3735,8 @@ class DateLookup extends PureComponent {
3732
3735
  originalDate: null,
3733
3736
  min: getStartOfDay(props.min),
3734
3737
  max: getStartOfDay(props.max),
3735
- viewMonth: (props.value || new Date()).getMonth(),
3736
- viewYear: (props.value || new Date()).getFullYear(),
3738
+ viewMonth: (props.value || (props.min || props.max) && moveToWithinRange(new Date(), props.min, props.max) || new Date()).getMonth(),
3739
+ viewYear: (props.value || (props.min || props.max) && moveToWithinRange(new Date(), props.min, props.max) || new Date()).getFullYear(),
3737
3740
  open: false,
3738
3741
  mode: 'day',
3739
3742
  isMobile: false
@@ -3879,9 +3882,7 @@ class DateLookup extends PureComponent {
3879
3882
  } else {
3880
3883
  date = getStartOfDay(new Date());
3881
3884
  }
3882
- if (date) {
3883
- date = moveToWithinRange(date, min, max);
3884
- }
3885
+ date &&= moveToWithinRange(date, min, max);
3885
3886
  if (date?.getTime() !== selectedDate?.getTime()) {
3886
3887
  this.props.onChange(date);
3887
3888
  }