From e681f1f36fca14d655ce42fd6077f886f2ee4e9d Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 6 Sep 2023 20:59:59 +0300 Subject: [PATCH] #1069 Fix sort by date for v2 cards --- server.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/server.js b/server.js index 0ae0d38cb..4c0497669 100644 --- a/server.js +++ b/server.js @@ -309,8 +309,8 @@ function getTiktokenTokenizer(model) { return tokenizer; } -function humanizedISO8601DateTime(date = Date.now()) { - let baseDate = new Date(date); +function humanizedISO8601DateTime(date) { + let baseDate = typeof date === 'number' ? new Date(date) : new Date(); let humanYear = baseDate.getFullYear(); let humanMonth = (baseDate.getMonth() + 1); let humanDate = baseDate.getDate(); @@ -981,7 +981,6 @@ function readFromV2(char) { }); char['chat'] = char['chat'] ?? humanizedISO8601DateTime(); - char['create_date'] = char['create_date'] ?? humanizedISO8601DateTime(); return char; } @@ -1012,7 +1011,6 @@ function charaFormatData(data) { _.set(char, 'chat', data.ch_name + ' - ' + humanizedISO8601DateTime()); _.set(char, 'talkativeness', data.talkativeness); _.set(char, 'fav', data.fav == 'true'); - _.set(char, 'create_date', humanizedISO8601DateTime()); // Spec V2 fields _.set(char, 'spec', 'chara_card_v2');