User:Gary/comments in local time.js: Difference between revisions

Content deleted Content added
Undid revision 1016315793 by Xaosflux (talk)
lint
Line 131:
const minute = addLeadingZero(time.getMinutes());
const finalTime = `${hour}:${minute}${ampm}`;
let returnDate;
 
// Determine the time offset.
Line 138 ⟶ 137:
utcValue >= 0 ? `+${utcValue}` : `−${Math.abs(utcValue.toFixed(1))}`;
 
ifconst returnDate = (this.LocalComments.timeFirst) {
returnDate =? `${finalTime}, ${date} (UTC${utcOffset})`;
returnDate =: `${date}, ${finalTime} (UTC${utcOffset})`;
} else {
returnDate = `${date}, ${finalTime} (UTC${utcOffset})`;
}
 
return { returnDate, time };
Line 366 ⟶ 363:
getHour(time) {
let ampm;
let hour = Number.parseInt(time.getHours(), 10);
 
if (this.LocalComments.twentyFourHours) {
Line 436 ⟶ 433:
const position = value.search(search);
const stringLength = match.toString().length;
const beforeMatch = value.substringslice(0, Math.max(0, position));
const afterMatch = value.substringslice(Math.max(0, position + stringLength));
const { returnDate, time } = this.adjustTime(
match.toString(),
Line 455 ⟶ 452:
 
parent = node.parentNode;
parentnode.replaceChildreplaceWith(span, node);
 
const before = document.createElement('span');
Line 467 ⟶ 464:
after.append(document.createTextNode(afterMatch));
 
parentspan.insertBeforebefore(before, span);
parent.insertBefore(after, span.nextSibling);
}