refactor: highlight today in calendar + monday is 1st day of week
This commit is contained in:
parent
a6a9ce4c0d
commit
ac7f544512
|
|
@ -326,6 +326,24 @@ export default function TimeEntryDetailsPage() {
|
|||
newDate.setDate(date.getDate());
|
||||
setStart(newDate);
|
||||
}}
|
||||
firstDayOfWeek="monday"
|
||||
renderDay={(date) => {
|
||||
const day = date.getDate();
|
||||
const today = new Date();
|
||||
|
||||
const isToday =
|
||||
date.getDate() === today.getDate() &&
|
||||
date.getMonth() === today.getMonth() &&
|
||||
date.getFullYear() === today.getFullYear();
|
||||
|
||||
return isToday ? (
|
||||
<Text component="div" weight="bold" underline>
|
||||
{day}
|
||||
</Text>
|
||||
) : (
|
||||
<Text component="div">{day}</Text>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<TimeInput
|
||||
id="new-startTime-time"
|
||||
|
|
@ -390,6 +408,24 @@ export default function TimeEntryDetailsPage() {
|
|||
newDate.setDate(date.getDate());
|
||||
setEnd(newDate);
|
||||
}}
|
||||
firstDayOfWeek="monday"
|
||||
renderDay={(date) => {
|
||||
const day = date.getDate();
|
||||
const today = new Date();
|
||||
|
||||
const isToday =
|
||||
date.getDate() === today.getDate() &&
|
||||
date.getMonth() === today.getMonth() &&
|
||||
date.getFullYear() === today.getFullYear();
|
||||
|
||||
return isToday ? (
|
||||
<Text component="div" weight="bold" underline>
|
||||
{day}
|
||||
</Text>
|
||||
) : (
|
||||
<Text component="div">{day}</Text>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<TimeInput
|
||||
id="new-endTime-time"
|
||||
|
|
|
|||
|
|
@ -312,6 +312,7 @@ export default function NewTimeEntryPage() {
|
|||
locale="it"
|
||||
placeholder="Start date"
|
||||
label="Start date"
|
||||
firstDayOfWeek="monday"
|
||||
aria-invalid={actionData?.errors?.startTime ? true : undefined}
|
||||
error={actionData?.errors?.startTime}
|
||||
errorProps={{ children: actionData?.errors?.startTime }}
|
||||
|
|
@ -324,6 +325,23 @@ export default function NewTimeEntryPage() {
|
|||
newDate.setDate(date.getDate());
|
||||
setStart(newDate);
|
||||
}}
|
||||
renderDay={(date) => {
|
||||
const day = date.getDate();
|
||||
const today = new Date();
|
||||
|
||||
const isToday =
|
||||
date.getDate() === today.getDate() &&
|
||||
date.getMonth() === today.getMonth() &&
|
||||
date.getFullYear() === today.getFullYear();
|
||||
|
||||
return isToday ? (
|
||||
<Text component="div" weight="bold" underline>
|
||||
{day}
|
||||
</Text>
|
||||
) : (
|
||||
<Text component="div">{day}</Text>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<TimeInput
|
||||
id="new-startTime-time"
|
||||
|
|
@ -371,6 +389,7 @@ export default function NewTimeEntryPage() {
|
|||
locale="it"
|
||||
placeholder="End date"
|
||||
label="End date"
|
||||
firstDayOfWeek="monday"
|
||||
aria-invalid={actionData?.errors?.endTime ? true : undefined}
|
||||
error={actionData?.errors?.endTime}
|
||||
errorProps={{ children: actionData?.errors?.endTime }}
|
||||
|
|
@ -383,6 +402,23 @@ export default function NewTimeEntryPage() {
|
|||
newDate.setDate(date.getDate());
|
||||
setEnd(newDate);
|
||||
}}
|
||||
renderDay={(date) => {
|
||||
const day = date.getDate();
|
||||
const today = new Date();
|
||||
|
||||
const isToday =
|
||||
date.getDate() === today.getDate() &&
|
||||
date.getMonth() === today.getMonth() &&
|
||||
date.getFullYear() === today.getFullYear();
|
||||
|
||||
return isToday ? (
|
||||
<Text component="div" weight="bold" underline>
|
||||
{day}
|
||||
</Text>
|
||||
) : (
|
||||
<Text component="div">{day}</Text>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<TimeInput
|
||||
id="new-endTime-time"
|
||||
|
|
|
|||
Loading…
Reference in a new issue