Add an accommodations reservations module #188

Merged
pierre merged 81 commits from accomodation_module into master 2024-06-22 21:30:26 +00:00
3 changed files with 14 additions and 7 deletions
Showing only changes of commit 1305667f24 - Show all commits

View File

@ -252,8 +252,9 @@ export function AccommodationsReservationsRoute(): React.ReactElement {
const u = users?.find((u) => u.user_id === r.user_id); const u = users?.find((u) => u.user_id === r.user_id);
return { return {
title: `${u?.user_name} - ${a.name}`, title: `${u?.user_name} - ${a.name}`,
start: fmtUnixDateFullCalendar(r.reservation_start), start: fmtUnixDateFullCalendar(r.reservation_start, false),
end: fmtUnixDateFullCalendar(r.reservation_end), end: fmtUnixDateFullCalendar(r.reservation_end, true),
allDay: true,
color: a.color ? "#" + a.color : undefined, color: a.color ? "#" + a.color : undefined,
borderColor: borderColor:
r.validated === true r.validated === true

View File

@ -8,18 +8,25 @@ export function fmtUnixDate(time: number): string {
/** /**
* Get formatted UNIX date for Full Calendar * Get formatted UNIX date for Full Calendar
*/ */
export function fmtUnixDateFullCalendar(time: number): string { export function fmtUnixDateFullCalendar(
const d = new Date(time * 1000); time: number,
correctEnd: boolean
): string {
let d = new Date(time * 1000);
if (d.getHours() > 0 && correctEnd)
d = new Date(time * 1000 + 3600 * 24 * 1000);
const s = `${d.getFullYear()}-${(d.getMonth() + 1) const s = `${d.getFullYear()}-${(d.getMonth() + 1)
.toString(10) .toString(10)
.padStart(2, "0")}-${d.getDate().toString(10).padStart(2, "0")}T${d .padStart(2, "0")}-${d.getDate().toString(10).padStart(2, "0")}`; /*T${d
.getHours() .getHours()
.toString(10) .toString(10)
.padStart(2, "0")}:${d.getMinutes().toString(10).padStart(2, "0")}:${d .padStart(2, "0")}:${d.getMinutes().toString(10).padStart(2, "0")}:${d
.getSeconds() .getSeconds()
.toString(10) .toString(10)
.padStart(2, "0")}`; .padStart(2, "0")}`*/
console.log(s, d);
return s; return s;
} }

View File

@ -89,7 +89,6 @@ export function PropDateInput(p: {
v = v.set("minutes", 0); v = v.set("minutes", 0);
v = v.set("seconds", 0); v = v.set("seconds", 0);
} }
console.log(midDay, v, v.get("hours"));
p.onChange(v.unix()); p.onChange(v.unix());
}} }}