Change @luxon imports

pull/77/head
MillenniumEarl 2021-03-08 12:18:06 +01:00
parent 4ee0754410
commit f40354e79a
2 changed files with 6 additions and 7 deletions

View File

@ -7,7 +7,7 @@
// Public modules from npm // Public modules from npm
import cheerio from "cheerio"; import cheerio from "cheerio";
import luxon from "luxon"; import { DateTime } from "luxon";
// Modules from files // Modules from files
import { urls } from "../../constants/url.js"; import { urls } from "../../constants/url.js";
@ -180,10 +180,10 @@ export default class PlatformUser {
// Parse date // Parse date
const joined = $(MEMBER.JOINED)?.attr("datetime"); const joined = $(MEMBER.JOINED)?.attr("datetime");
if (luxon.DateTime.fromISO(joined).isValid) this._joined = new Date(joined); if (DateTime.fromISO(joined).isValid) this._joined = new Date(joined);
const lastSeen = $(MEMBER.LAST_SEEN)?.attr("datetime"); const lastSeen = $(MEMBER.LAST_SEEN)?.attr("datetime");
if (luxon.DateTime.fromISO(lastSeen).isValid) this._joined = new Date(lastSeen); if (DateTime.fromISO(lastSeen).isValid) this._joined = new Date(lastSeen);
// Parse donation // Parse donation
const donation = $(MEMBER.AMOUNT_DONATED)?.text().replace("$", ""); const donation = $(MEMBER.AMOUNT_DONATED)?.text().replace("$", "");

View File

@ -7,7 +7,7 @@
// Public modules from npm // Public modules from npm
import cheerio from "cheerio"; import cheerio from "cheerio";
import luxon from "luxon"; import { DateTime } from "luxon";
// Modules from files // Modules from files
import Post from "./post.js"; import Post from "./post.js";
@ -265,9 +265,8 @@ export default class Thread {
this._category = JSONLD["articleSection"] as TCategory; this._category = JSONLD["articleSection"] as TCategory;
// Validate the dates // Validate the dates
if (luxon.DateTime.fromISO(modified).isValid) this._modified = new Date(modified); if (DateTime.fromISO(modified).isValid) this._modified = new Date(modified);
if (luxon.DateTime.fromISO(published).isValid) if (DateTime.fromISO(published).isValid) this._publication = new Date(published);
this._publication = new Date(published);
} else throw htmlResponse.value; } else throw htmlResponse.value;
} }