Skip to content

Commit

Permalink
shrink date on message board card
Browse files Browse the repository at this point in the history
  • Loading branch information
NyaomiDEV committed Feb 9, 2025
1 parent a13cf6a commit e3ab0d5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
6 changes: 5 additions & 1 deletion src/components/MessageBoardCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
<div class="flexbox">
<div class="subheader">
<span>{{ props.boardMessage.member.name }}</span>
<p>{{ formatDate(props.boardMessage.date, true) }}</p>
<p>{{ formatDate(props.boardMessage.date, "collapsed") }}</p>
</div>
<div class="contents">
<h1>{{ props.boardMessage.title }}</h1>
Expand Down Expand Up @@ -225,6 +225,10 @@
color: var(--ion-text-color-step-400);
}
ion-card .subheader p {
text-align: right;
}
ion-card .contents {
display: flex;
flex-direction: column;
Expand Down
4 changes: 2 additions & 2 deletions src/components/frontingEntry/FrontingEntryLabel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
let intervalRef: number;
function format(startTime: Date, endTime?: Date){
if(!endTime) return formatDate(startTime, true);
if(!endTime) return formatDate(startTime, "expanded");
const start = dayjs(startTime);
const end = dayjs(endTime);
if(end.valueOf() - start.endOf('day').valueOf() <= 0) // same day
return formatDate(startTime) + "~" + formatDate(endTime);
return formatDate(startTime, true) + " - " + formatDate(endTime, true);
return formatDate(startTime, "expanded") + " - " + formatDate(endTime, "expanded");
}
onMounted(() => {
Expand Down
6 changes: 3 additions & 3 deletions src/lib/util/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ export async function decompressGzip(data: Uint8Array) {
return result;
}

export function formatDate(date: Date, expanded?: boolean){
if(expanded)
return dayjs(date).format(`LL, ${appConfig.locale.twelveHourClock ? 'hh:mm A' : "HH:mm"}`);
export function formatDate(date: Date, withDate?: "collapsed" | "expanded"){
if(withDate)
return dayjs(date).format(`${withDate == "expanded" ? "LL" : "ll"}, ${appConfig.locale.twelveHourClock ? 'hh:mm A' : "HH:mm"}`);
return dayjs(date).format(`${appConfig.locale.twelveHourClock ? 'hh:mm A' : "HH:mm"}`);
}

Expand Down
4 changes: 2 additions & 2 deletions src/modals/FrontingEntryEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
<IonItem button @click="$refs.startTimePicker?.$el.present()">
<IonLabel>
<h2>{{ $t("frontHistory:edit.startTime") }}</h2>
<p>{{ formatDate(frontingEntry.startTime, true) }}</p>
<p>{{ formatDate(frontingEntry.startTime, "expanded") }}</p>
</IonLabel>
<DatePopupPicker
v-model="frontingEntry.startTime"
Expand All @@ -170,7 +170,7 @@
<IonItem button v-if="frontingEntry.endTime" @click="$refs.endTimePicker?.$el.present()">
<IonLabel>
<h2>{{ $t("frontHistory:edit.endTime") }}</h2>
<p>{{ formatDate(frontingEntry.endTime, true) }}</p>
<p>{{ formatDate(frontingEntry.endTime, "expanded") }}</p>
</IonLabel>
<DatePopupPicker
v-model="frontingEntry.endTime"
Expand Down
2 changes: 1 addition & 1 deletion src/views/edit/MemberEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
</IonItem>
<IonItem v-if="member.dateCreated" button @click="copyIdToClipboard">
<IonLabel>
<p>{{ $t("members:edit.dateCreated", { dateCreated: formatDate(member.dateCreated, true) }) }}</p>
<p>{{ $t("members:edit.dateCreated", { dateCreated: formatDate(member.dateCreated, "expanded") }) }}</p>
</IonLabel>
</IonItem>
</IonList>
Expand Down

0 comments on commit e3ab0d5

Please sign in to comment.