clean code and fix date display bug

This commit is contained in:
schooltechx 2023-04-08 11:37:22 +07:00
parent 9012d03515
commit e5a3f1793f
4 changed files with 4 additions and 79 deletions

View file

@ -1,5 +1,5 @@
//import type {Exam} from '$lib/data/CMSDataType'
import { error } from '@sveltejs/kit'
import dayjs from 'dayjs'
import type { PageServerLoad } from './$types'
export const load: PageServerLoad = async ({params,fetch}) => {
const id = params.id+""
@ -11,6 +11,7 @@ export const load: PageServerLoad = async ({params,fetch}) => {
throw error(500,{message:`พบข้อผิดพลาดเกี่ยวกับข้อมูลสอบคัดเลือก ${id}`})
}
const post = await res.json()
post.date= post.start? dayjs(post.start).format("DD MMM BBBB"):""
return post
}

View file

@ -1,5 +1,6 @@
//import type {Exam} from '$lib/data/CMSDataType'
import { error } from '@sveltejs/kit'
import dayjs from 'dayjs'
import type { PageServerLoad } from './$types'
export const load: PageServerLoad = async ({params,fetch}) => {
const id = params.id+""
@ -11,6 +12,7 @@ export const load: PageServerLoad = async ({params,fetch}) => {
throw error(500,{message:`พบข้อผิดพลาดเกี่ยวกับข้อมูลสอบคัดเลือก ${id}`})
}
const post = await res.json()
post.date= post.start? dayjs(post.start).format("DD MMM BBBB"):""
return post
}