Skip to content

Commit

Permalink
Fix date validation logic in CollectionModal to ensure start date is …
Browse files Browse the repository at this point in the history
…before end date and handle missing start date
  • Loading branch information
seanmorley15 committed Dec 28, 2024
1 parent 46e3e91 commit 5d3ec18
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AdventureLog: Self-hostable travel tracker and trip planner.
Copyright (C) 2024 Sean Morley
Copyright (C) 2023-2025 Sean Morley
Contact: [email protected]

This program is free software: you can redistribute it and/or modify
Expand Down
13 changes: 13 additions & 0 deletions frontend/src/lib/components/CollectionModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@
collection.end_date = collection.start_date;
}
if (
collection.start_date &&
collection.end_date &&
collection.start_date > collection.end_date
) {
addToast('error', $t('adventures.start_before_end_error'));
return;
}
if (!collection.start_date && collection.end_date) {
collection.start_date = collection.end_date;
}
if (collection.id === '') {
let res = await fetch('/api/collections', {
method: 'POST',
Expand Down

0 comments on commit 5d3ec18

Please sign in to comment.