Fix validation in Lodging model to check check-in and check-out dates; update LodgingCard to conditionally display timezone
This commit is contained in:
@@ -787,8 +787,8 @@ class Lodging(models.Model):
|
|||||||
updated_at = models.DateTimeField(auto_now=True)
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
if self.date and self.end_date and self.date > 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.date) + ' End date: ' + str(self.end_date))
|
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:
|
||||||
if self.collection.is_public and not self.is_public:
|
if self.collection.is_public and not self.is_public:
|
||||||
|
|||||||
@@ -138,7 +138,9 @@
|
|||||||
<p>
|
<p>
|
||||||
{formatDateInTimezone(lodging.check_in ?? '', lodging.timezone ?? undefined)} –
|
{formatDateInTimezone(lodging.check_in ?? '', lodging.timezone ?? undefined)} –
|
||||||
{formatDateInTimezone(lodging.check_out ?? '', 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>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user