aboutsummaryrefslogtreecommitdiff
path: root/public/javascripts/weekSelector.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/javascripts/weekSelector.js')
-rw-r--r--public/javascripts/weekSelector.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/public/javascripts/weekSelector.js b/public/javascripts/weekSelector.js
index 2a8bb62..1cf5b56 100644
--- a/public/javascripts/weekSelector.js
+++ b/public/javascripts/weekSelector.js
@@ -33,15 +33,36 @@ self.getSelectedWeek = function () {
self.updateCurrentWeek = function () {
const selectedWeekNumber = self.getSelectedWeek()
- self._nodes.currentWeekText.textContent = `Week ${selectedWeekNumber}`
if (self.getCurrentWeek(new Date()) !== selectedWeekNumber) {
self._nodes.currentWeekText.classList.add('changed')
} else {
self._nodes.currentWeekText.classList.remove('changed')
}
+ self.updateDom()
self.emit('weekChanged', selectedWeekNumber)
}
+self.updateDom = function () {
+ const selectedWeekNumber = self.getSelectedWeek()
+ let humanReadableWeek = null
+ switch (self._weekOffset) {
+ case 0:
+ humanReadableWeek = 'Huidige week'
+ break
+ case 1:
+ humanReadableWeek = 'Volgende week'
+ break
+ case -1:
+ humanReadableWeek = 'Vorige week'
+ break
+ }
+ if (humanReadableWeek != null) {
+ self._nodes.currentWeekText.textContent = `${humanReadableWeek} • ${selectedWeekNumber}`
+ } else {
+ self._nodes.currentWeekText.textContent = `Week ${selectedWeekNumber}`
+ }
+}
+
self._handlePrevButtonClick = function () {
self._weekOffset -= 1
self.updateCurrentWeek()