mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Use single format for chat timestamps
This commit is contained in:
@ -1153,7 +1153,8 @@ export function addCopyToCodeBlocks(messageElement) {
|
||||
|
||||
function addOneMessage(mes, { type = "normal", insertAfter = null, scroll = true } = {}) {
|
||||
var messageText = mes["mes"];
|
||||
var timestamp = mes.send_date;
|
||||
const momentDate = timestampToMoment(mes.send_date);
|
||||
const timestamp = momentDate.isValid() ? momentDate.format('LL LT') : '';
|
||||
|
||||
if (mes?.extra?.display_text) {
|
||||
messageText = mes.extra.display_text;
|
||||
@ -5494,6 +5495,7 @@ async function createOrEditCharacter(e) {
|
||||
chat[0]["is_name"] = true;
|
||||
chat[0]["mes"] = this_ch_mes;
|
||||
chat[0]["extra"] = {};
|
||||
chat[0]["send_date"] = getMessageTimeStamp();
|
||||
|
||||
const alternateGreetings = characters[this_chid]?.data?.alternate_greetings;
|
||||
|
||||
|
@ -273,6 +273,10 @@ export function isOdd(number) {
|
||||
}
|
||||
|
||||
export function timestampToMoment(timestamp) {
|
||||
if (!timestamp) {
|
||||
return moment.invalid();
|
||||
}
|
||||
|
||||
// Unix time (legacy TAI)
|
||||
if (typeof timestamp === 'number') {
|
||||
return moment(timestamp);
|
||||
|
Reference in New Issue
Block a user