[utils] IsoDateTime, do not set time if used as date input

This commit is contained in:
Ferdinand Thiessen 2021-04-04 21:38:27 +02:00
parent 6a6afcb2d4
commit 6f053d849a
2 changed files with 6 additions and 2 deletions

View File

@ -127,7 +127,7 @@ export default defineComponent({
} }
function modifyDate(v: string, d: Date | undefined = props.modelValue) { function modifyDate(v: string, d: Date | undefined = props.modelValue) {
if (!d) d = new Date(); if (!d) d = q_date.buildDate({ hours: 0, minutes: 0, seconds: 0 });
if (/^\d{4}-\d\d-\d\d$/.test(v)) { if (/^\d{4}-\d\d-\d\d$/.test(v)) {
const split = v.split('-'); const split = v.split('-');
return q_date.adjustDate(d, { return q_date.adjustDate(d, {

View File

@ -17,8 +17,12 @@ export function formatDateTime(
return dateTimeFormat.format(date); return dateTimeFormat.format(date);
} }
export function asDate(date?: Date) {
return date ? formatDateTime(date, true) : '';
}
export function asHour(date?: Date) { export function asHour(date?: Date) {
if (date) return formatDateTime(date, false, true); return date ? formatDateTime(date, false, true) : '';
} }
export function startOfWeek(date: Date, startMonday = true) { export function startOfWeek(date: Date, startMonday = true) {