Created
December 21, 2023 02:55
-
-
Save ReinforceZwei/af3254b0282e74f74addf2a73b4636a9 to your computer and use it in GitHub Desktop.
Trilium Calendar: Set Sunday as first weekday
This file contains 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
// Move "SUN" to first day of week | |
$('.calendar-week').children().last().prependTo('.calendar-week') | |
let marginStep = 14.28; | |
let config = { | |
childList: true, | |
subtree: true | |
} | |
let callback = (mutationList, observer) => { | |
let date = new Date($('.calendar-body').children().first().attr('data-calendar-date')); | |
let weekday = date.getDay(); | |
let newMargin = weekday * marginStep; | |
$('.calendar-body').children().first().css('margin-left', `${newMargin}%`); | |
} | |
let target = $('.calendar-dropdown-widget')[0]; | |
let observer = new MutationObserver(callback); | |
observer.observe(target, config); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment