Skip to content

Commit

Permalink
fix: mark today in outside days
Browse files Browse the repository at this point in the history
  • Loading branch information
schummar committed Nov 30, 2022
1 parent 8d7059c commit c5b9f6e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/datePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export function DatePicker({
onOffsetChanged: (offset) => setDateInView(new Date(dateInView.getFullYear(), dateInView.getMonth() + offset)),
offset: 0,
});
const now = useMemo(() => startOfDay(new Date()), []);

const formatWeekday = useMemo(() => {
const { format } = new Intl.DateTimeFormat(locale, { weekday: 'short' });
Expand Down Expand Up @@ -215,7 +216,8 @@ export function DatePicker({
return <div />;
}

const { prevMonth, nextMonth, date, today } = dateObj;
const { prevMonth, nextMonth, date } = dateObj;
const today = startOfDay(date).getTime() === now.getTime();

const selected = date.getTime() === min?.getTime() || (min && max && dateIntersect(date, { min, max }));
const preSelected =
Expand Down

0 comments on commit c5b9f6e

Please sign in to comment.