This commit is contained in:
Mirco Wittrien 2022-02-09 23:17:21 +01:00
parent b61406e497
commit c319a4a555
2 changed files with 6 additions and 6 deletions

View File

@ -6026,7 +6026,7 @@ module.exports = (_ => {
.replace(/\$month/g, timeObj.toLocaleDateString(language, {month: "long"}))
.replace(/\$dayS/g, timeObj.toLocaleDateString(language, {weekday: "short"}))
.replace(/\$day/g, timeObj.toLocaleDateString(language, {weekday: "long"}))
.replace(/\$agoAmount/g, daysAgo < 0 ? "" : daysAgo > 1 ? BDFDB.LanguageUtils.LanguageStringsFormat(`GAME_LIBRARY_LAST_PLAYED_${daysAgo > 80 ? "MONTHS" : daysAgo > 30 ? "WEEKS" : "DAYS"}`, daysAgo > 80 ? Math.round(daysAgo/30) : daysAgo > 30 ? Math.round(daysAgo/7) : daysAgo) : BDFDB.LanguageUtils.LanguageStrings[`SEARCH_SHORTCUT_${daysAgo == 1 ? "YESTERDAY" : "TODAY"}`])
.replace(/\$agoAmount/g, daysAgo < 0 ? "" : daysAgo > 1 ? BDFDB.DiscordObjects.Timestamp(timeObj.getTime()).fromNow() : BDFDB.LanguageUtils.LanguageStrings[`SEARCH_SHORTCUT_${daysAgo == 1 ? "YESTERDAY" : "TODAY"}`])
.replace(/\$agoDays/g, daysAgo < 0 ? "" : daysAgo > 1 ? BDFDB.LanguageUtils.LanguageStringsFormat(`GAME_LIBRARY_LAST_PLAYED_DAYS`, daysAgo) : BDFDB.LanguageUtils.LanguageStrings[`SEARCH_SHORTCUT_${daysAgo == 1 ? "YESTERDAY" : "TODAY"}`])
.replace(/\$agoDate/g, daysAgo < 0 ? "" : daysAgo > 1 ? date : BDFDB.LanguageUtils.LanguageStrings[`SEARCH_SHORTCUT_${daysAgo == 1 ? "YESTERDAY" : "TODAY"}`])
.replace(/\(\)|\[\]/g, "").replace(/,\s*$|^\s*,/g, "").replace(/ +/g, " ").trim();

View File

@ -2,7 +2,7 @@
* @name CompleteTimestamps
* @author DevilBro
* @authorId 278543574059057154
* @version 1.6.0
* @version 1.6.1
* @description Replaces Timestamps with your own custom Timestamps
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,12 +17,12 @@ module.exports = (_ => {
"info": {
"name": "CompleteTimestamps",
"author": "DevilBro",
"version": "1.6.0",
"version": "1.6.1",
"description": "Replaces Timestamps with your own custom Timestamps"
},
"changeLog": {
"fixed": {
"Markup Timestamps": "Fixed issue where Markup Timestamps sometimes, wouldn't get parsed correctly"
"improved": {
"Markup Timestamps": "Only changes Timestamps with no formatting flag or the lowercase f flag, since those are the standard timestamps, meaning it does no longer change markup timestamps with a relative R or full flag F"
}
}
};
@ -108,7 +108,7 @@ module.exports = (_ => {
onStart () {
BDFDB.LibraryModules.MessageParser && BDFDB.LibraryModules.MessageParser.defaultRules && BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.MessageParser.defaultRules.timestamp, "react", {after: e => {
const date = 1e3*Number(e.methodArguments[0].timestamp);
if (this.settings.general.showInMarkup) {
if (this.settings.general.showInMarkup && e.methodArguments[0].formatted == BDFDB.LibraryModules.MessageParser.defaultRules.timestamp.parse([null, e.methodArguments[0].timestamp, "f"]).formatted) {
if (tooltipIsSame) e.returnValue.props.delay = 99999999999999999999;
let timestamp = this.formatTimestamp(this.settings.dates.timestampDate, date);
let renderChildren = e.returnValue.props.children;