@transferwise/components 0.0.0-experimental-954122c → 0.0.0-experimental-bb7ed4a

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.js CHANGED
@@ -2610,6 +2610,10 @@ const isMonthAndYearFormat = dateString => validDateString(dateString) && dateSt
2610
2610
  const MDY = new Set(['en-US']);
2611
2611
  const YMD = new Set(['hu', 'hu-HU', 'zh-HK', 'zh-CN', 'ja', 'ja-JP']);
2612
2612
 
2613
+ const returnDateView = (selectedDate, min, max) => {
2614
+ return selectedDate || (min || max) && moveToWithinRange(new Date(), min, max) || new Date();
2615
+ };
2616
+
2613
2617
  var messages$9 = reactIntl.defineMessages({
2614
2618
  monthLabel: {
2615
2619
  id: "neptune.DateInput.month.label"
@@ -3766,8 +3770,8 @@ class DateLookup extends React.PureComponent {
3766
3770
  originalDate: null,
3767
3771
  min: getStartOfDay(props.min),
3768
3772
  max: getStartOfDay(props.max),
3769
- viewMonth: (props.value || (props.min || props.max) && moveToWithinRange(new Date(), props.min, props.max) || new Date()).getMonth(),
3770
- viewYear: (props.value || (props.min || props.max) && moveToWithinRange(new Date(), props.min, props.max) || new Date()).getFullYear(),
3773
+ viewMonth: returnDateView(props.value, props.min, props.max).getMonth(),
3774
+ viewYear: returnDateView(props.value, props.min, props.max).getFullYear(),
3771
3775
  open: false,
3772
3776
  mode: 'day',
3773
3777
  isMobile: false
@@ -3788,7 +3792,7 @@ class DateLookup extends React.PureComponent {
3788
3792
  props.onChange(moveToWithinRange(selectedDate, min, max));
3789
3793
  return null;
3790
3794
  }
3791
- const viewDateThatIsWithinRange = selectedDate || (min || max) && moveToWithinRange(new Date(), min, max) || new Date();
3795
+ const viewDateThatIsWithinRange = returnDateView(selectedDate, min, max);
3792
3796
  const viewMonth = viewDateThatIsWithinRange.getMonth();
3793
3797
  const viewYear = viewDateThatIsWithinRange.getFullYear();
3794
3798
  return {