From 8b1be0607f3ce9433ca42b42e6202f93d228e330 Mon Sep 17 00:00:00 2001 From: Arif Budiman Date: Sun, 3 Sep 2023 17:47:51 -0700 Subject: [PATCH] Bug fix for single digit days --- sites/moji.id/moji.id.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sites/moji.id/moji.id.config.js b/sites/moji.id/moji.id.config.js index 926b0f97..b9c4ffe3 100644 --- a/sites/moji.id/moji.id.config.js +++ b/sites/moji.id/moji.id.config.js @@ -54,7 +54,7 @@ function parseItems(context) { const $ = cheerio.load(context.content) const schDayMonths = $('.date-slider .month').toArray() const schPrograms = $('.desc-slider .list-slider').toArray() - const monthDate = dayjs(context.date).format('MMM D') + const monthDate = dayjs(context.date).format('MMM DD') const items = []; schDayMonths.forEach(function(schDayMonth, i) { @@ -99,6 +99,6 @@ function parseStop(schDayMonth, itemCurrent, itemNext) { } else { - return dayjs.tz(currentYear + ' ' + monthDate[0] + ' ' + (parseInt(monthDate[1]) + 1) + ' 00:00', 'YYYY MMM DD HH:mm', 'Asia/Jakarta') + return dayjs.tz(currentYear + ' ' + monthDate[0] + ' ' + (parseInt(monthDate[1]) + 1).toString().padStart(2, '0') + ' 00:00', 'YYYY MMM DD HH:mm', 'Asia/Jakarta') } } \ No newline at end of file