ปรับหน้าลงเวลาเข้างาน, ออกงาน, ประวัติการลาเวลา
This commit is contained in:
parent
421f4d5805
commit
7f0e41ff31
15 changed files with 696 additions and 191 deletions
|
|
@ -100,6 +100,41 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
return date.getDate().toString().padStart(2, "0") + " " + dstMonth + " " + dstYear + dstTime
|
||||
}
|
||||
|
||||
function dateThai(srcDate: Date, isFullMonth: boolean = true, isTime: boolean = false) {
|
||||
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 = ["มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"]
|
||||
const abbrMonthThai = ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."]
|
||||
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 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") + " " + dstMonth + " " + dstYear + dstTime
|
||||
}
|
||||
|
||||
function dateMonth2Thai(srcDate: Date, isFullMonth = false, isTime = false) {
|
||||
if (!srcDate) return srcDate
|
||||
const date = new Date(srcDate)
|
||||
|
|
@ -597,6 +632,7 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
return {
|
||||
calAge,
|
||||
date2Thai,
|
||||
dateThai,
|
||||
dateToISO,
|
||||
notify,
|
||||
notifyError,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue