เเก้ให้ปี ต่ำสุด คศ 0001
This commit is contained in:
parent
270808981f
commit
fe672a5aff
2 changed files with 8 additions and 18 deletions
|
|
@ -129,7 +129,7 @@ const close = async () => {
|
|||
};
|
||||
</script>
|
||||
<template>
|
||||
<q-dialog v-model="props.Modal">
|
||||
<q-dialog v-model="props.Modal" persistent>
|
||||
<q-card style="max-width: 100%; width: 80%">
|
||||
<q-form ref="myForm">
|
||||
<div class="row">
|
||||
|
|
|
|||
|
|
@ -76,13 +76,12 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
) {
|
||||
if (srcDate == null) {
|
||||
return null;
|
||||
`
|
||||
`;
|
||||
}
|
||||
|
||||
const date = new Date(srcDate);
|
||||
const isValidDate = Boolean(+date);
|
||||
if (!isValidDate) return srcDate.toString();
|
||||
if (isValidDate && date.getFullYear() < 1000) return srcDate.toString();
|
||||
|
||||
const fullMonthThai = [
|
||||
"มกราคม",
|
||||
"กุมภาพันธ์",
|
||||
|
|
@ -111,26 +110,17 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
"พ.ย.",
|
||||
"ธ.ค.",
|
||||
];
|
||||
let dstYear = 0;
|
||||
if (date.getFullYear() > 2500) {
|
||||
dstYear = date.getFullYear();
|
||||
} else {
|
||||
dstYear = date.getFullYear() + 543;
|
||||
}
|
||||
let dstMonth = "";
|
||||
if (isFullMonth) {
|
||||
dstMonth = fullMonthThai[date.getMonth()];
|
||||
} else {
|
||||
dstMonth = abbrMonthThai[date.getMonth()];
|
||||
}
|
||||
|
||||
let dstYear = date.getFullYear() < 1 ? "0001" : (date.getFullYear() + 543).toString();
|
||||
let dstMonth = isFullMonth ? fullMonthThai[date.getMonth()] : abbrMonthThai[date.getMonth()];
|
||||
let dstTime = "";
|
||||
|
||||
if (isTime) {
|
||||
const H = date.getHours().toString().padStart(2, "0");
|
||||
const M = date.getMinutes().toString().padStart(2, "0");
|
||||
// const S = date.getSeconds().toString().padStart(2, "0")
|
||||
// dstTime = " " + H + ":" + M + ":" + S + " น."
|
||||
dstTime = " " + H + ":" + M + " น.";
|
||||
}
|
||||
|
||||
return (
|
||||
date.getDate().toString().padStart(2, "0") +
|
||||
" " +
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue