Skip to content

Commit

Permalink
Fix a few date issues & logic for badges
Browse files Browse the repository at this point in the history
  • Loading branch information
slmnio committed Jan 1, 2025
1 parent 1977115 commit 251f10d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions website/src/components/website/dashboard/AdvancedDateEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,21 @@
class="mb-2"
name="datetime-editor"
type="datetime-local"
:min="earliestTime ? safeTime(earliestTime, '{year}-{iso-month}-{date-pad}T{hour-pad}:{minute-pad}') : null"
:max="latestTime ? safeTime(latestTime, '{year}-{iso-month}-{date-pad}T{hour-pad}:{minute-pad}') : null"
step="300"
:model-value="temporaryTime || safeSavedTime"
@update:model-value="(val) => temporaryTime = val" />

<div class="earliest-latest-warning py-2 flex-center text-center my-2 border border-primary rounded" :class="{'bg-danger text-white': isValid === false}">
<div v-if="earliestTime || latestTime" class="earliest-latest-warning py-2 flex-center text-center my-2 border border-primary rounded" :class="{'bg-danger text-white': isValid === false}">
<div v-if="earliestTime && !latestTime">
This match must start at or after <b>{{ formatTime(earliestTime) }}</b>
This match must start at or after <b>{{ safeTime(earliestTime, "{day-short} {date-ordinal} {month-short} {year} {time} {tz}") }}</b>
</div>
<div v-else-if="!earliestTime && latestTime">
This match must start at or before <b>{{ formatTime(latestTime) }}</b>
This match must start at or before <b>{{ safeTime(latestTime, "{day-short} {date-ordinal} {month-short} {year} {time} {tz}") }}</b>
</div>
<div v-else-if="earliestTime && latestTime">
This match must start between <b>{{ formatTime(earliestTime) }}</b> and<br><b>{{ formatTime(latestTime) }}</b>
This match must start between <b>{{ safeTime(earliestTime, "{day-short} {date-ordinal} {month-short} {year} {time} {tz}") }}</b> and<br><b>{{ safeTime(latestTime, "{day-short} {date-ordinal} {month-short} {year} {time} {tz}") }}</b>
</div>
</div>

Expand Down Expand Up @@ -129,13 +132,13 @@ export default {
},
methods: {
formatTime, spacetime,
safeTime(timeString) {
safeTime(timeString, customFormat) {
if (!timeString || typeof timeString !== "string") return null;
return this.formatTime(
timeString,
{
tz: this.editTimeInSiteTimezone ? this.siteTimezone : this.localTimezone,
format: SafeTimeFormat,
format: customFormat || SafeTimeFormat,
use24HourTime: this.$store.state.use24HourTime }
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="timezone-swapper" :class="{'align-left': align === 'left'}">
<b-form :inline="inline">
<b-form-group label-size="sm" label="Timezone" :label-cols-sm="inline ? 3 : 12">
<b-form-group label-size="sm" label="Site timezone" :label-cols-sm="inline ? 3 : 12">
<b-form-select id="available-timezone-select" v-model="timezone" :options="availableTimezones" size="sm" />
</b-form-group>
<b-form-checkbox v-if="!inline" v-model="use24HourTime" size="sm" switch>
Expand Down
2 changes: 1 addition & 1 deletion website/src/utils/content-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ export function getReschedulingBadge({ state, report }, eventSettings) {
const reschedule = state.has_start ? "Reschedule" : "Schedule";

console.log("existing report", state.has_existing_report, "is staff", state.is_staff);
if (!state.has_existing_report && !state.is_staff) {
if (!state.has_existing_report && state.is_on_teams) {
// no report but could make one
console.log("could make", JSON.stringify(report), state.has_existing_report);
return {
Expand Down

0 comments on commit 251f10d

Please sign in to comment.