Added @luxon for date validation
parent
338ec6d50d
commit
65e9c5c870
|
@ -2,6 +2,7 @@
|
|||
|
||||
// Public modules from npm
|
||||
const cheerio = require("cheerio");
|
||||
const {DateTime} = require("luxon");
|
||||
|
||||
// Modules from file
|
||||
const { fetchHTML, getUrlRedirect } = require("./network-helper.js");
|
||||
|
@ -256,11 +257,11 @@ function parseMainPostText(text) {
|
|||
}
|
||||
|
||||
// Last update of the main post
|
||||
if (data.UPDATED) {
|
||||
if (data.UPDATED && DateTime.fromISO(data.UPDATED).isValid) {
|
||||
parsedDict["LastUpdate"] = new Date(data.UPDATED);
|
||||
delete data.UPDATED;
|
||||
}
|
||||
else if (data.THREAD_UPDATED) {
|
||||
else if (data.THREAD_UPDATED && DateTime.fromISO(data.THREAD_UPDATED).isValid) {
|
||||
parsedDict["LastUpdate"] = new Date(data.THREAD_UPDATED);
|
||||
delete data.THREAD_UPDATED;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "f95api",
|
||||
"version": "1.7.0",
|
||||
"version": "1.9.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1643,6 +1643,11 @@
|
|||
"streamroller": "^2.2.4"
|
||||
}
|
||||
},
|
||||
"luxon": {
|
||||
"version": "1.25.0",
|
||||
"resolved": "https://registry.npmjs.org/luxon/-/luxon-1.25.0.tgz",
|
||||
"integrity": "sha512-hEgLurSH8kQRjY6i4YLey+mcKVAWXbDNlZRmM6AgWDJ1cY3atl8Ztf5wEY7VBReFbmGnwQPz7KYJblL8B2k0jQ=="
|
||||
},
|
||||
"make-dir": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
"ky": "^0.25.0",
|
||||
"ky-universal": "^0.8.2",
|
||||
"log4js": "^6.3.0",
|
||||
"luxon": "^1.25.0",
|
||||
"tough-cookie": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
Loading…
Reference in New Issue