Skip to content

Commit

Permalink
Merge pull request #30810 from Expensify/jasper-fixDateRegression
Browse files Browse the repository at this point in the history
[CP Staging] Fix issue where displayed selected date is a day before actually selected date

(cherry picked from commit bd1ecb3)
  • Loading branch information
NikkiWines authored and OSBotify committed Nov 3, 2023
1 parent 759fc94 commit a61572e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/components/NewDatePicker/CalendarPicker/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {addMonths, endOfMonth, format, getYear, isSameDay, setDate, setYear, startOfDay, subMonths} from 'date-fns';
import {addMonths, endOfMonth, format, getYear, isSameDay, parseISO, setDate, setYear, startOfDay, subMonths} from 'date-fns';
import Str from 'expensify-common/lib/str';
import PropTypes from 'prop-types';
import React from 'react';
Expand Down Expand Up @@ -205,8 +205,7 @@ class CalendarPicker extends React.PureComponent {
const isBeforeMinDate = currentDate < startOfDay(new Date(this.props.minDate));
const isAfterMaxDate = currentDate > startOfDay(new Date(this.props.maxDate));
const isDisabled = !day || isBeforeMinDate || isAfterMaxDate;
const isSelected = isSameDay(new Date(this.props.value), new Date(currentYearView, currentMonthView, day));

const isSelected = isSameDay(parseISO(this.props.value), new Date(currentYearView, currentMonthView, day));
return (
<PressableWithoutFeedback
key={`${index}_day-${day}`}
Expand Down

0 comments on commit a61572e

Please sign in to comment.