diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-11-29 08:57:54 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-11-29 14:25:00 +0100 |
commit | 84cfbe6b1966943e7df04afc3d29ba8a3597cf4c (patch) | |
tree | cf564784bab88f10daeec244c8480b9d55971874 /apps/dav | |
parent | e589232815f5a89f25aa3bd963f307290bad82ba (diff) | |
download | nextcloud-server-84cfbe6b1966943e7df04afc3d29ba8a3597cf4c.tar.gz nextcloud-server-84cfbe6b1966943e7df04afc3d29ba8a3597cf4c.zip |
fix(dav): Allow single-day out of office
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/Controller/AvailabilitySettingsController.php | 2 | ||||
-rw-r--r-- | apps/dav/src/components/AbsenceForm.vue | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/apps/dav/lib/Controller/AvailabilitySettingsController.php b/apps/dav/lib/Controller/AvailabilitySettingsController.php index daa39df470e..73e322896d8 100644 --- a/apps/dav/lib/Controller/AvailabilitySettingsController.php +++ b/apps/dav/lib/Controller/AvailabilitySettingsController.php @@ -66,7 +66,7 @@ class AvailabilitySettingsController extends Controller { $parsedFirstDay = new DateTimeImmutable($firstDay); $parsedLastDay = new DateTimeImmutable($lastDay); - if ($parsedFirstDay->getTimestamp() >= $parsedLastDay->getTimestamp()) { + if ($parsedFirstDay->getTimestamp() > $parsedLastDay->getTimestamp()) { throw new \Exception('First day is on or after last day'); } diff --git a/apps/dav/src/components/AbsenceForm.vue b/apps/dav/src/components/AbsenceForm.vue index 500004b755a..6fb1c4ce1fd 100644 --- a/apps/dav/src/components/AbsenceForm.vue +++ b/apps/dav/src/components/AbsenceForm.vue @@ -89,11 +89,17 @@ export default { * @return {boolean} */ valid() { + // Translate the two date objects to midnight for an accurate comparison + const firstDay = new Date(this.firstDay?.getTime()) + const lastDay = new Date(this.lastDay?.getTime()) + firstDay?.setHours(0, 0, 0, 0) + lastDay?.setHours(0, 0, 0, 0) + return !!this.firstDay && !!this.lastDay && !!this.status && !!this.message - && this.lastDay > this.firstDay + && lastDay >= firstDay }, }, methods: { |