Skip to content

Instantly share code, notes, and snippets.

@djrosenbaum
Created January 2, 2023 13:42
Show Gist options
  • Save djrosenbaum/ea87854698c2b5464793b9419365cc69 to your computer and use it in GitHub Desktop.
Save djrosenbaum/ea87854698c2b5464793b9419365cc69 to your computer and use it in GitHub Desktop.
vacations to go - include sailing day of the week
// When viewing cruise listings on vacations to go, the sailing dates only include the month and day.
// This script can get pasted into Chrome's browser console to include the day of the week
// For example, to easily view which cruises leave on a specific day of the week such as Thursday
$$('td.dt').forEach(td => {
var textContent = td.textContent.trim();
if (!/\d/.test(textContent)) {
// return if no numbers in the string, invalid date
return;
}
if (!textContent.includes(',')) {
// include current year by default
textContent = textContent + ', ' + new Date().getFullYear();
}
td.textContent = new Date(textContent).toDateString();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment