mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-23 14:59: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:
parent
8538aa0b7c
commit
330fabb3e0
2 changed files with 5 additions and 3 deletions
|
@ -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:
|
||||
|
|
|
@ -138,7 +138,9 @@
|
|||
<p>
|
||||
{formatDateInTimezone(lodging.check_in ?? '', lodging.timezone ?? undefined)} –
|
||||
{formatDateInTimezone(lodging.check_out ?? '', lodging.timezone ?? undefined)}
|
||||
<span class="text-xs opacity-60 ml-1">({lodging.timezone})</span>
|
||||
{#if lodging.timezone}
|
||||
<span class="text-xs opacity-60 ml-1">({lodging.timezone})</span>
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue