Created
January 2, 2023 13:42
-
-
Save djrosenbaum/ea87854698c2b5464793b9419365cc69 to your computer and use it in GitHub Desktop.
vacations to go - include sailing day of the week
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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