use YYYY-MM-DD for date formats

This commit is contained in:
Hayden 2023-01-28 13:26:51 -09:00
parent e7d76cbe49
commit f94d772202
No known key found for this signature in database
GPG key ID: 17CF79474E257545
3 changed files with 7 additions and 7 deletions

View file

@ -3,13 +3,13 @@
<label class="label">
<span class="label-text"> Date </span>
</label>
<input ref="input" v-model="selected" type="date" class="input input-bordered w-full" pattern="yyyy-MM-dd" />
<input ref="input" v-model="selected" type="date" class="input input-bordered w-full" />
</div>
<div v-else class="sm:grid sm:grid-cols-4 sm:items-start sm:gap-4">
<label class="label">
<span class="label-text"> Date </span>
</label>
<input v-model="selected" type="date" class="input input-bordered col-span-3 w-full mt-2" pattern="yyyy-MM-dd" />
<input v-model="selected" type="date" class="input input-bordered col-span-3 w-full mt-2" />
</div>
</template>

View file

@ -63,11 +63,11 @@ export function fmtDate(value: string | Date, fmt: DateTimeFormat = "human"): st
switch (fmt) {
case "relative":
return useTimeAgo(dt).value + useDateFormat(dt, " (MM-DD-YYYY)").value;
return useTimeAgo(dt).value + useDateFormat(dt, " (YYYY-MM-DD)").value;
case "long":
return useDateFormat(dt, "MM-DD-YYYY (dddd)").value;
return useDateFormat(dt, "YYYY-MM-DD (dddd)").value;
case "short":
return useDateFormat(dt, "MM-DD-YYYY").value;
return useDateFormat(dt, "YYYY-MM-DD").value;
case "human":
// January 1st, 2021
return `${months[dt.getMonth()]} ${dt.getDate()}${ordinalIndicator(dt.getDate())}, ${dt.getFullYear()}`;

View file

@ -1,7 +1,7 @@
import { BaseAPI, route } from "../base";
import { GroupStatistics, TotalsByOrganizer, ValueOverTime } from "../types/data-contracts";
function YYYY_DD_MM(date?: Date): string {
function YYYY_MM_DD(date?: Date): string {
if (!date) {
return "";
}
@ -14,7 +14,7 @@ function YYYY_DD_MM(date?: Date): string {
export class StatsAPI extends BaseAPI {
totalPriceOverTime(start?: Date, end?: Date) {
return this.http.get<ValueOverTime>({
url: route("/groups/statistics/purchase-price", { start: YYYY_DD_MM(start), end: YYYY_DD_MM(end) }),
url: route("/groups/statistics/purchase-price", { start: YYYY_MM_DD(start), end: YYYY_MM_DD(end) }),
});
}