mirror of
https://github.com/hay-kot/homebox.git
synced 2025-08-04 08:40:28 +00:00
use YYYY-MM-DD for date formats
This commit is contained in:
parent
e7d76cbe49
commit
f94d772202
3 changed files with 7 additions and 7 deletions
|
@ -3,13 +3,13 @@
|
||||||
<label class="label">
|
<label class="label">
|
||||||
<span class="label-text"> Date </span>
|
<span class="label-text"> Date </span>
|
||||||
</label>
|
</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>
|
||||||
<div v-else class="sm:grid sm:grid-cols-4 sm:items-start sm:gap-4">
|
<div v-else class="sm:grid sm:grid-cols-4 sm:items-start sm:gap-4">
|
||||||
<label class="label">
|
<label class="label">
|
||||||
<span class="label-text"> Date </span>
|
<span class="label-text"> Date </span>
|
||||||
</label>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -63,11 +63,11 @@ export function fmtDate(value: string | Date, fmt: DateTimeFormat = "human"): st
|
||||||
|
|
||||||
switch (fmt) {
|
switch (fmt) {
|
||||||
case "relative":
|
case "relative":
|
||||||
return useTimeAgo(dt).value + useDateFormat(dt, " (MM-DD-YYYY)").value;
|
return useTimeAgo(dt).value + useDateFormat(dt, " (YYYY-MM-DD)").value;
|
||||||
case "long":
|
case "long":
|
||||||
return useDateFormat(dt, "MM-DD-YYYY (dddd)").value;
|
return useDateFormat(dt, "YYYY-MM-DD (dddd)").value;
|
||||||
case "short":
|
case "short":
|
||||||
return useDateFormat(dt, "MM-DD-YYYY").value;
|
return useDateFormat(dt, "YYYY-MM-DD").value;
|
||||||
case "human":
|
case "human":
|
||||||
// January 1st, 2021
|
// January 1st, 2021
|
||||||
return `${months[dt.getMonth()]} ${dt.getDate()}${ordinalIndicator(dt.getDate())}, ${dt.getFullYear()}`;
|
return `${months[dt.getMonth()]} ${dt.getDate()}${ordinalIndicator(dt.getDate())}, ${dt.getFullYear()}`;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { BaseAPI, route } from "../base";
|
import { BaseAPI, route } from "../base";
|
||||||
import { GroupStatistics, TotalsByOrganizer, ValueOverTime } from "../types/data-contracts";
|
import { GroupStatistics, TotalsByOrganizer, ValueOverTime } from "../types/data-contracts";
|
||||||
|
|
||||||
function YYYY_DD_MM(date?: Date): string {
|
function YYYY_MM_DD(date?: Date): string {
|
||||||
if (!date) {
|
if (!date) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ function YYYY_DD_MM(date?: Date): string {
|
||||||
export class StatsAPI extends BaseAPI {
|
export class StatsAPI extends BaseAPI {
|
||||||
totalPriceOverTime(start?: Date, end?: Date) {
|
totalPriceOverTime(start?: Date, end?: Date) {
|
||||||
return this.http.get<ValueOverTime>({
|
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) }),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue