I'm newbie with Javascript. I have that js code;
(function($) {
"use strict";
var options = {
events_source: 'event.php',
view: 'month',
tmpl_path: 'tmpls/',
tmpl_cache: false,
day: '2022-12-31',
onAfterEventsLoad: function(events) {
if(!events) {
return;
}
var list = $('#eventlist');
list.html('');
$.each(events, function(key, val) {
$(document.createElement('li'))
.html('<a href="' val.url '">' val.title '</a>')
.appendTo(list);
});
},
I couldn't find how can i change "day: '2022-12-31'" to today date automaticly ? I tried some methods but didn't work.
Thanks for advice.
I tried let day = d.getDate();
CodePudding user response:
You can use below code in your day property.
day: new Date().toISOString().slice(0,10);