clean code and fix date display bug
This commit is contained in:
parent
9012d03515
commit
e5a3f1793f
4 changed files with 4 additions and 79 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue