-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1435 from maykinmedia/swr/hackathon-ui-tweaks
Final UI tweaks
- Loading branch information
Showing
4 changed files
with
50 additions
and
45 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
// Get the end date from the Django context | ||
const einddatum = new Date('{{ bericht.einddatum_handelingstermijn }}') | ||
const today = new Date() | ||
const berichtDataJsonElement = document.getElementById('bericht-data-json') | ||
|
||
// Calculate the remaining days | ||
const remainingTime = einddatum - today // in milliseconds | ||
const remainingDays = Math.ceil(remainingTime / (1000 * 60 * 60 * 24)) // convert to days | ||
if (berichtDataJsonElement) { | ||
const berichtData = JSON.parse(berichtDataJsonElement.textContent) | ||
const einddatum = new Date(berichtData.einddatumHandelingstermijn) | ||
const today = new Date() | ||
|
||
// Display the result | ||
const remainingDaysElement = document.getElementById('remainingDays') | ||
if (remainingDaysElement) { | ||
console.log('ELEMNT {{ bericht.publicatiedatum }} BESTAAT') | ||
if (remainingDays > 0) { | ||
remainingDaysElement.textContent = `Er zijn nog ${remainingDays} dagen tot de einddatum.` | ||
} else if (remainingDays === 0) { | ||
remainingDaysElement.textContent = 'Vandaag is de einddatum.' | ||
} else { | ||
remainingDaysElement.textContent = 'De einddatum is verstreken.' | ||
} | ||
// Calculate the remaining days | ||
const remainingTime = einddatum - today // in milliseconds | ||
const remainingDays = Math.ceil(remainingTime / (1000 * 60 * 60 * 24)) // convert to days | ||
|
||
// Display the result | ||
const remainingDaysElement = document.getElementById('remainingDays') | ||
if (remainingDaysElement) { | ||
if (remainingDays > 0) { | ||
remainingDaysElement.textContent = `Er zijn nog ${remainingDays} dagen tot de einddatum.` | ||
} else if (remainingDays === 0) { | ||
remainingDaysElement.textContent = 'Vandaag is de einddatum.' | ||
} else { | ||
remainingDaysElement.textContent = 'De einddatum is verstreken.' | ||
} | ||
} else console.error('Unable to find #remainingDays') | ||
} |
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