Skip to content

Commit

Permalink
Adding comments and using getElementById
Browse files Browse the repository at this point in the history
  • Loading branch information
LoicBonavent committed Oct 12, 2023
1 parent 3235297 commit f871197
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pod/video/static/js/video_stats_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,15 @@ $(() => {
pager: "#pager",
sortorder: "asc",
beforeProcessing: function (data) {
// Avoid "data.filter is not a function" error (if change number of lines or page)
try {
// Set min date
let min_date = data.filter((obj) => {
return obj.min_date != undefined;
});
// remove date_min in data
data.pop();
document.querySelector("#jsperiode").min = min_date[0].min_date;
document.getElementById("jsperiode").min = min_date[0].min_date;
}
catch(uselesserr) { }
},
Expand All @@ -116,7 +117,7 @@ $(() => {
});
let today = new Date().toISOString().split("T")[0];
$("#jsperiode").val(today); // set date input value to today
document.querySelector("#jsperiode").max = today;
document.getElementById("jsperiode").max = today;

$("#jsperiode").on("change paste keyup", function (e) {
if ($(this).val() != undefined && $(this).val().trim() !== "") {
Expand Down

0 comments on commit f871197

Please sign in to comment.