mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-12-23 22:58:17 -05:00
Fix date validation logic in CollectionModal to ensure start date is before end date and handle missing start date
This commit is contained in:
2
LICENSE
2
LICENSE
@@ -1,5 +1,5 @@
|
|||||||
AdventureLog: Self-hostable travel tracker and trip planner.
|
AdventureLog: Self-hostable travel tracker and trip planner.
|
||||||
Copyright (C) 2024 Sean Morley
|
Copyright (C) 2023-2025 Sean Morley
|
||||||
Contact: contact@seanmorley.com
|
Contact: contact@seanmorley.com
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -51,6 +51,19 @@
|
|||||||
collection.end_date = collection.start_date;
|
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 === '') {
|
if (collection.id === '') {
|
||||||
let res = await fetch('/api/collections', {
|
let res = await fetch('/api/collections', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
Reference in New Issue
Block a user