Catch timestamp error

This commit is contained in:
Bryan Ashby 2022-09-30 23:55:28 -06:00
parent 6e1c470b69
commit d8bc02ce46
No known key found for this signature in database
GPG Key ID: C2C1B501E4EFD994
1 changed files with 10 additions and 3 deletions

View File

@ -315,9 +315,16 @@ exports.getModule = class MessageListModule extends (
let msgNum = 1; let msgNum = 1;
self.config.messageList.forEach((listItem, index) => { self.config.messageList.forEach((listItem, index) => {
listItem.msgNum = msgNum++; listItem.msgNum = msgNum++;
listItem.ts = moment(listItem.modTimestamp).format( try {
dateTimeFormat listItem.ts = moment(listItem.modTimestamp).format(
); dateTimeFormat
);
} catch (e) {
self.client.log.warn(
`Error parsing "${listItem.modTimestamp}"; expected timestamp: ${e.message}`
);
listItem.ts = moment().format(dateTimeFormat);
}
const isNew = _.isBoolean(listItem.isNew) const isNew = _.isBoolean(listItem.isNew)
? listItem.isNew ? listItem.isNew
: listItem.messageId > self.lastReadId; : listItem.messageId > self.lastReadId;