Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Somewhat hacky method to add applicationPeriod.end 2 hours later #278

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions components/form/DatePickerInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@ const DatePickerInput = (props: Props) => {
const [toDate, setToDate] = useState("");

useEffect(() => {
const startDate = fromDate ? `${fromDate}T00:00` : "";
const endDate = toDate ? `${toDate}T23:59` : "";
const startDate = fromDate ? `${fromDate}T02:00` : "";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hvorfor 2 på natta på startDate?


let endDate = toDate ? `${toDate}T00:00` : "";

if (endDate) {
const endDateObj = new Date(endDate);
endDateObj.setDate(endDateObj.getDate() + 2);
endDateObj.setHours(endDateObj.getHours() - 22);
endDate = endDateObj.toISOString();
}
Comment on lines +14 to +21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trenger vi alt dette? kan vi ikke bare bruke endDate og sette dagen til +1?

noe sånn:

Suggested change
let endDate = toDate ? `${toDate}T00:00` : "";
if (endDate) {
const endDateObj = new Date(endDate);
endDateObj.setDate(endDateObj.getDate() + 2);
endDateObj.setHours(endDateObj.getHours() - 22);
endDate = endDateObj.toISOString();
}
constendDate = toDate ? `${toDate}T02:00` : "";
if (endDate) {
endDate.setDate(endDateObj.getDate() + 1);
}

Også bare toISOString() på start og end date før de returneres


props.updateDates({ start: startDate, end: endDate });
}, [fromDate, toDate]);

Expand Down