显示具体日期而不是“2 星期前”,“1 年前”这种
< Feedback de 以绝对时间 (yyyy-mm-dd) 显示 YouTube 的视频上传日期
If you can live with "-" between the sections, you can use
let options = { weekday: 'long', day: 'numeric', month: 'numeric', year: 'numeric' };
let lang = navigator.language ? navigator.language : 'en-US';
this gives "Saturday, 12-07-2025"
to change the "-" you would have to fiddle with more code.
let options = { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' };
let lang = navigator.language ? navigator.language : 'en-US';
this gives "Saturday 12 July 2025"
HTH
If you can live with "-" between the sections, you can use
let options = { weekday: 'long', day: 'numeric', month: 'numeric', year: 'numeric' };
let lang = navigator.language ? navigator.language : 'en-US';
this gives "Saturday, 12-07-2025"
to change the "-" you would have to fiddle with more code.
let options = { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' };
let lang = navigator.language ? navigator.language : 'en-US';
this gives "Saturday 12 July 2025"
HTH
To get the dots:
let options = { weekday: 'long', day: 'numeric', month: 'numeric', year: 'numeric', separator: '.' };
let lang = navigator.language ? navigator.language : 'en-US';
return date.toLocaleDateString(lang, options).replaceAll('/', '.');
this gives "Tuesday, 15.07.2025"
HTH
If you can live with "-" between the sections, you can use
let options = { weekday: 'long', day: 'numeric', month: 'numeric', year: 'numeric' };
let lang = navigator.language ? navigator.language : 'en-US';
this gives "Saturday, 12-07-2025"
to change the "-" you would have to fiddle with more code.
let options = { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' };
let lang = navigator.language ? navigator.language : 'en-US';
this gives "Saturday 12 July 2025"
HTHTo get the dots:
let options = { weekday: 'long', day: 'numeric', month: 'numeric', year: 'numeric', separator: '.' };
let lang = navigator.language ? navigator.language : 'en-US';
return date.toLocaleDateString(lang, options).replaceAll('/', '.');
this gives "Tuesday, 15.07.2025"
HTH
Thank you very much for all, it works perfectly ;-)
Great! Happy to help! :)
Now if someone would fix the Subscriptions page, I would be happy too :)
Great! Happy to help! :)
Now if someone would fix the Subscriptions page, I would be happy too :)
Yes, I understand you very well :-)
This script is very good but unfortunately after testing it everywhere on YouTube :
- It doesn't work in the Subscriptions page : https://www.youtube.com/feed/subscriptions
- It doesn't work in the Watch Video Recommendations Sidebar
- The actual date doesn't appear entirely next to the relative date and don't go to the line when the actual date is long with the display from 5 rows
Who can therefore improve all this please ?
This script is very good but unfortunately after testing it everywhere on YouTube :- It doesn't work in the Subscriptions page : https://www.youtube.com/feed/subscriptions- It doesn't work in the Watch Video Recommendations Sidebar- The actual date doesn't appear entirely next to the relative date and don't go to the line when the actual date is long with the display from 5 rowsWho can therefore improve all this please ?
Fixed the sidebar in the latest update. Since the script works correctly on the subscription page on my PC, I won't make changes to that section.
Fixed the sidebar in the latest update.
Since the script works correctly on the subscription page on my PC, I won't make changes to that section.
Please would you try both grid view and list view?
This script is very good but unfortunately after testing it everywhere on YouTube :- It doesn't work in the Subscriptions page : https://www.youtube.com/feed/subscriptions- It doesn't work in the Watch Video Recommendations Sidebar- The actual date doesn't appear entirely next to the relative date and don't go to the line when the actual date is long with the display from 5 rowsWho can therefore improve all this please ?
Fixed the sidebar in the latest update.
Since the script works correctly on the subscription page on my PC, I won't make changes to that section.
Thank you for the Watch Video Recommendations Sidebar :-)
However on my side in the French YouTube, it's exactly as @mrtickle explains it here :
-> https://greasyforks.org/fr/scripts/493024-%E4%BB%A5%E7%BB%9D%E5%AF%B9%E6%97%B6%E9%97%B4-yyyy-mm-dd-%E6%98%BE%E7%A4%BA-youtube-%E7%9A%84%E8%A7%86%E9%A2%91%E4%B8%8A%E4%BC%A0%E6%97%A5%E6%9C%9F/discussions/304016
With the Grid View, it doesn't work :
With the List View, it works :
@mrtickle Very sorry but, can you show me how to modify the script to remove the relative date please ?
Because, I see that you don't use the relative date either if I'm not mistaken...
@mrtickle Very sorry but, can you show me how to modify the script to remove the relative date please ?
Because, I see that you don't use the relative date either if I'm not mistaken...
Certainly.
In the function fetchAndUpdateUploadDate which goes from line 135 to line 151 in today's new version 0.4.2
find this section, should start on line 140:
if (!oldUploadRegex.test(originalDateText)) {
// Keep original + formatted date for recent uploads
displayText = `${originalDateText} · ${formattedDate}`;
} else {
// Show only absolute date
displayText = formattedDate;
}
The top half is what to print if it's a recent video (ie "today"). The bottom half is what to print for all other dates.
The most surgical change is to make both of them "displayText = formattedDate;", so you would have something like
if (!oldUploadRegex.test(originalDateText)) {
// Keep original + formatted date for recent uploads
// displayText = `${originalDateText} · ${formattedDate}`;
// actually, show only absolute date here too
displayText = formattedDate;
} else {
// Show only absolute date
displayText = formattedDate;
}
This lets you put it back easily if you change your mind.
HTH
The script uses the same selector for both the subscription page and home page. In fact, the homepage section of the code handles many pages not specified in the script. To check if the selector is working correctly, try running document.querySelectorAll('#content > ytd-rich-grid-media > #dismissible > #details > #meta > ytd-video-meta-block > #metadata');
in your browser console.
Since I can't reproduce this issue, please share the code for the "homepage list - videos" section with the AI directly. Describe your problem and ask it to help debug.
@mrtickle Very sorry but, can you show me how to modify the script to remove the relative date please ?
Because, I see that you don't use the relative date either if I'm not mistaken...Certainly.
In the function fetchAndUpdateUploadDate which goes from line 135 to line 151 in today's new version 0.4.2
find this section, should start on line 140:
if (!oldUploadRegex.test(originalDateText)) {
// Keep original + formatted date for recent uploads
displayText = `${originalDateText} · ${formattedDate}`;
} else {
// Show only absolute date
displayText = formattedDate;
}
The top half is what to print if it's a recent video (ie "today"). The bottom half is what to print for all other dates.
The most surgical change is to make both of them "displayText = formattedDate;", so you would have something like
if (!oldUploadRegex.test(originalDateText)) {
// Keep original + formatted date for recent uploads
// displayText = `${originalDateText} · ${formattedDate}`;
// actually, show only absolute date here too
displayText = formattedDate;
} else {
// Show only absolute date
displayText = formattedDate;
}
This lets you put it back easily if you change your mind.
HTH
Thank you very much again and very sorry for my late, because the French YouTube really drives you crazy :-(
For hours, I have been modifying with various configurations the absolute date so that it works correctly on my side without success...
An example of madness :
The only problem with the script on my PC is that it's not adapted for French, so it always displays dates in two formats.
@InMirrors Thank you for confirming to me that the French YouTube is the problem :-(
Hello,
I just would like to know how to modify your script without errors to display these 2 French time formats please :
-> Monday 14.07.2025
-> Monday 14 July 2025
Thank you for your answer.
Google Chrome and Mozilla Firefox Browsers with Tampermonkey or Violentmonkey