humanizedDateTime zero-pads month & day

b40012973e8803c0d69632a588493198b77c440f

Succubyss <87207237+Succubyss@users.noreply.github.com>

1 files changed, +9 -12Ignore whitespace
public/scripts/RossAscends-mods.js+9 -12
@@ -157,18 +157,15 @@ export function shouldSendOnEnter() {
157157//Does not break old characters/chats, as the code just uses whatever timestamp exists in the chat.
158158//New chats made with characters will use this new formatting.
159159export function humanizedDateTime() {
160160 letconst baseDatenow = new Date(Date.now());
161- let humanYear = baseDate.getFullYear();
161+ const dt = {
162- let humanMonth = baseDate.getMonth() + 1;
162+ year: now.getFullYear(), month: now.getMonth() + 1, day: now.getDate(),
163- let humanDate = baseDate.getDate();
163+ hour: now.getHours(), minute: now.getMinutes(), second: now.getSeconds(),
164- let humanHour = (baseDate.getHours() < 10 ? '0' : '') + baseDate.getHours();
164+ }
165- let humanMinute =
165+ for (const key in dt) {
166- (baseDate.getMinutes() < 10 ? '0' : '') + baseDate.getMinutes();
166+ dt[key] = dt[key].toString().padStart(2, '0');
167- let humanSecond =
167+ }
168- (baseDate.getSeconds() < 10 ? '0' : '') + baseDate.getSeconds();
168+ return `${dt.year}-${dt.month}-${dt.day}@${dt.hour}h${dt.minute}m${dt.second}s`;
169- let HumanizedDateTime =
170- humanYear + '-' + humanMonth + '-' + humanDate + '@' + humanHour + 'h' + humanMinute + 'm' + humanSecond + 's';
171- return HumanizedDateTime;
172169}
173170
174171//this is a common format version to display a timestamp on each chat message