This commit is contained in:
Mirco Wittrien 2020-06-09 18:50:42 +02:00
parent 3db27a5b3a
commit 7072b3a6d4
4 changed files with 8 additions and 8 deletions

View File

@ -308,7 +308,7 @@ var CompleteTimestamps = (_ => {
}
getTimestamp (languageId, time) {
let timeobj = time ? time : new Date();
let timeobj = time || new Date();
if (typeof time == "string") timeobj = new Date(time);
if (timeobj.toString() == "Invalid Date") timeobj = new Date(parseInt(time));
if (timeobj.toString() == "Invalid Date") return;

View File

@ -269,7 +269,7 @@ var CreationDate = (_ => {
}
getTimestamp (languageId, time) {
let timeobj = time ? time : new Date();
let timeobj = time || new Date();
if (typeof time == "string") timeobj = new Date(time);
if (timeobj.toString() == "Invalid Date") timeobj = new Date(parseInt(time));
if (timeobj.toString() == "Invalid Date") return;

View File

@ -279,12 +279,12 @@ var JoinedAtDate = (_ => {
else if (!loadedUsers[guildId][user.id]) requestedUsers[guildId][user.id].push(instance);
else children.splice(index, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextScroller, {
className: "joinedAtDate " + BDFDB.disCN.textrow,
children: this.labels.joinedat_text.replace("{{time}}", this.getTimestamp(languages[formats.joinedAtDateLang].id, loadedUsers[guildId][user.id]))
children: this.labels.joinedat_text.replace("{{time}}", this.getTimestamp(languages[choices.joinedAtDateLang].id, loadedUsers[guildId][user.id]))
}));
}
getTimestamp (languageId, time) {
let timeobj = time ? time : new Date();
let timeobj = time || new Date();
if (typeof time == "string") timeobj = new Date(time);
if (timeobj.toString() == "Invalid Date") timeobj = new Date(parseInt(time));
if (timeobj.toString() == "Invalid Date") return;

View File

@ -277,14 +277,14 @@ var LastMessageDate = (_ => {
injectDate (instance, children, index, user) {
if (!BDFDB.ArrayUtils.is(children) || !user || user.discriminator == "0000") return;
let guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
let isguild = !!guildId;
let isGuild = !!guildId;
guildId = guildId || BDFDB.LibraryModules.LastChannelStore.getChannelId();
if (!guildId) return;
if (!loadedUsers[guildId]) loadedUsers[guildId] = {};
if (!requestedUsers[guildId]) requestedUsers[guildId] = {};
if (!BDFDB.ArrayUtils.is(requestedUsers[guildId][user.id])) {
requestedUsers[guildId][user.id] = [instance];
BDFDB.LibraryModules.APIUtils.get((isguild ? BDFDB.DiscordConstants.Endpoints.SEARCH_GUILD(guildId) : BDFDB.DiscordConstants.Endpoints.SEARCH_CHANNEL(guildId)) + "?author_id=" + user.id).then(result => {
BDFDB.LibraryModules.APIUtils.get((isGuild ? BDFDB.DiscordConstants.Endpoints.SEARCH_GUILD(guildId) : BDFDB.DiscordConstants.Endpoints.SEARCH_CHANNEL(guildId)) + "?author_id=" + user.id).then(result => {
if (typeof result.body.retry_after != "number") {
if (result.body.messages && Array.isArray(result.body.messages[0])) {
for (let message of result.body.messages[0]) if (message.hit && message.author.id == user.id) {
@ -303,12 +303,12 @@ var LastMessageDate = (_ => {
else if (loadedUsers[guildId][user.id] === undefined) requestedUsers[guildId][user.id].push(instance);
else children.splice(index, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextScroller, {
className: "lastMessageDate " + BDFDB.disCN.textrow,
children: this.labels.lastmessage_text.replace("{{time}}", loadedUsers[guildId][user.id] ? this.getTimestamp(languages[formats.lastMessageDateLang].id, loadedUsers[guildId][user.id]) : "---")
children: this.labels.lastmessage_text.replace("{{time}}", loadedUsers[guildId][user.id] ? this.getTimestamp(languages[choices.lastMessageDateLang].id, loadedUsers[guildId][user.id]) : "---")
}));
}
getTimestamp (languageId, time) {
let timeobj = time ? time : new Date();
let timeobj = time || new Date();
if (typeof time == "string") timeobj = new Date(time);
if (timeobj.toString() == "Invalid Date") timeobj = new Date(parseInt(time));
if (timeobj.toString() == "Invalid Date") return;