From a13aacecc299c66bfc0c779d2545ad414a045422 Mon Sep 17 00:00:00 2001 From: Jake Meyer Date: Sat, 12 Jan 2019 14:48:02 -0600 Subject: [PATCH] Add regex replace to remove early/mid/late from any manifest dates --- scripts/upcoming.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/upcoming.js b/scripts/upcoming.js index a10e138f..99f098f0 100644 --- a/scripts/upcoming.js +++ b/scripts/upcoming.js @@ -160,12 +160,8 @@ const month_vague = /^[0-9]{4}\s(early|mid|late)\s([a-z]{3}|[a-z]{3,9})$/i; console.log(date); console.log(`${payload} : ${manifest_payload}`); - // Attempt to use chrono parser first for crazy date formats, and if it fails, feed it into the moment.js - // parser with previously known date formats - // Chrono sets the time at 12:00 when just the day is known, kinda weird - // Moment.js sets the time as 00:00 when only the day is known // Strip brackets from time given, and tack on UTC time offset at the end for date parser - const parsed_date = `${date.replace('[', '').replace(']', '')} +0000`; + const parsed_date = `${date.replace(/(early|mid|late)/i, '').replace('[', '').replace(']', '')} +0000`; const time = moment(parsed_date, ['YYYY MMM D HH:mm Z', 'YYYY MMM D Z', 'YYYY MMM Z', 'YYYY Q Z', 'YYYY Z']); // Feed stripped time into all possible date formats in the wiki currently