Skip to content

Commit

Permalink
support seconds in wiki updater
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewmeyer committed May 29, 2020
1 parent fbefb31 commit 2ba9a4d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/scripts/providers/wiki-manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ const checkDatePattern = async (mdate) => {
// 2020 Nov 4 [14:10]
const hour = /^\s*[0-9]{4}\s*([a-z]{3}|[a-z]{3,9})\s*[0-9]{1,2}\s*(\[?\s*[0-9]{2}:[0-9]{2}\s*\]?)\s*$/i;

// 2020 Nov 4 [14:10]
const second = /^\s*[0-9]{4}\s*([a-z]{3}|[a-z]{3,9})\s*[0-9]{1,2}\s*(\[?\s*[0-9]{2}:[0-9]{2}:[0-9]{2}\s*\]?)\s*$/i;

const result = {
mdate,
};
Expand Down Expand Up @@ -130,6 +133,8 @@ const checkDatePattern = async (mdate) => {
result.precision = 'day';
} else if (hour.test(cleaned)) {
result.precision = 'hour';
} else if (second.test(cleaned)) {
result.precision = 'hour';
} else {
// Send notification
console.log(`No match: ${cleaned}`);
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/upcoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const withinSensitiveTreshold = (time) => {
let lastRevision = null;

const parsedDate = `${date.replace(/(-|\[|\]|~|early|mid|late|end)/gi, ' ').split('/')[0].trim()} +0000`;
const timeWiki = moment(parsedDate, ['YYYY MMM D HH:mm Z', 'YYYY MMM D Z', 'YYYY MMM Z', 'YYYY Q Z', 'YYYY Z']);
const timeWiki = moment(parsedDate, ['YYYY MMM D HH:mm:ss Z', 'YYYY MMM D HH:mm Z', 'YYYY MMM D Z', 'YYYY MMM Z', 'YYYY Q Z', 'YYYY Z']);

// Is the launch within the update critical threshold?
if (withinSensitiveTreshold(timeWiki)) {
Expand Down

0 comments on commit 2ba9a4d

Please sign in to comment.