Merge branch 'develop' into dev

* develop:
  fix:format year
  fix:bug format datjs
This commit is contained in:
Warunee Tamkoo 2025-11-08 18:31:57 +07:00
commit c332802ffe
3 changed files with 8 additions and 4 deletions

View file

@ -12,7 +12,7 @@ export const load: PageServerLoad = async ({ fetch }) => {
exams.forEach((ex) => {
const { id, title, announcement_startDate } = ex;
const url = '/competitive/' + id;
ex.date = dayjs(announcement_startDate).format('DD MMM BBBB');
ex.date = dayjs(announcement_startDate).add(543, 'year').format('DD MMM YYYY');
ex.image = ex.image ? ex.image : '/images/exam_place_holder.png';
if (!ex.announcementExam) return; //ignore other date for normal post

View file

@ -12,7 +12,7 @@ export const load: PageServerLoad = async ({ fetch }) => {
exams.forEach((ex) => {
const { id, title, announcement_startDate } = ex;
const url = '/qualifying/' + id;
ex.date = dayjs(announcement_startDate).format('DD MMM BBBB');
ex.date = dayjs(announcement_startDate).add(543, 'year').format('DD MMM YYYY');
ex.image = ex.image ? ex.image : '/images/exam_place_holder.png';
if (!ex.announcementExam) return; //ignore other date for normal post

View file

@ -7,8 +7,12 @@
import dayjs from 'dayjs';
import { each } from 'svelte/internal';
function formatDate(start: string, end: string | undefined = undefined) {
if (!end) return dayjs(start).format('DD MMM BBBB');
return dayjs(start).format('DD MMM BBBB') + ' - ' + dayjs(end).format('DD MMM BBBB');
if (!end) return dayjs(start).add(543, 'year').format('DD MMM YYYY');
return (
dayjs(start).add(543, 'year').format('DD MMM YYYY') +
' - ' +
dayjs(end).add(543, 'year').format('DD MMM YYYY')
);
}
function isEndDatePassed(endDate: string | undefined) {
if (endDate) {