以絕對日期顯示 YouTube 的影片上傳日期 (yyyy-mm-dd 或其他自訂格式)

顯示絕對日期,而不是「2 週前」、「1 年前」等相對日期。可自訂日期和時間格式。

< 腳本以絕對日期顯示 YouTube 的影片上傳日期 (yyyy-mm-dd 或其他自訂格式)的回應

評論:正評 - 腳本一切正常

§
發表於:2025-05-08

To get both types like "5 hours ago - 2025-05-08" you need to replace this:

uploadDate = isoToDate(uploadDate);
holder.firstChild.nodeValue = uploadDate;
el.setAttribute('data-text', uploadDate);

with this:

let formattedDate = isoToDate(uploadDate);
holder.firstChild.nodeValue = dateText + ' - ' + formattedDate;
el.setAttribute('data-text', dateText + ' - ' + formattedDate);

You will get total of 9 replacements in this file at the end.

§
發表於:2025-05-08

Works like a charm! Thank you so much!

InMirrors作者
§
發表於:2025-06-01

Thank you for your suggestion. I've updated the script to show both date types for newly uploaded videos.

§
發表於:2025-07-15
編輯:2025-07-15

Thank you for your suggestion. I've updated the script to show both date types for newly uploaded videos.

This is a nice idea (for those who want it) but the regex contains characters which don't work on my UK PC.

this line:
const oldUploadRegex = /days?|weeks?|months?|years?|天|周|週|月|年/;

Those characters "天|周|週|月|年" are never shown on my page because it's not in that language? :)
edit: my mistake, those are just translations for days?|weeks?|months?|years. Sorry.

發表回覆

登入以回覆

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址