1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-22 22:39:36 +02:00

Fix validation in Lodging model to check check-in and check-out dates; update LodgingCard to conditionally display timezone

This commit is contained in:
Sean Morley 2025-05-10 13:17:01 -04:00
parent 8538aa0b7c
commit 330fabb3e0
2 changed files with 5 additions and 3 deletions

View file

@ -787,8 +787,8 @@ class Lodging(models.Model):
updated_at = models.DateTimeField(auto_now=True)
def clean(self):
if self.date and self.end_date and self.date > self.end_date:
raise ValidationError('The start date must be before the end date. Start date: ' + str(self.date) + ' End date: ' + str(self.end_date))
if self.check_in and self.check_out and self.check_in > self.check_out:
raise ValidationError('The start date must be before the end date. Start date: ' + str(self.check_in) + ' End date: ' + str(self.check_out))
if self.collection:
if self.collection.is_public and not self.is_public:

View file

@ -138,7 +138,9 @@
<p>
{formatDateInTimezone(lodging.check_in ?? '', lodging.timezone ?? undefined)}
{formatDateInTimezone(lodging.check_out ?? '', lodging.timezone ?? undefined)}
{#if lodging.timezone}
<span class="text-xs opacity-60 ml-1">({lodging.timezone})</span>
{/if}
</p>
</div>
{/if}