Within my datepicker navigation, I have implemented a system where the clicked date is converted to a string format (2015-08-31) and then stored in a cookie through the following code:
$datepicker_field.on('change', function (e) {
if ($(this).val()) {
//Converting mm/dd/yyyy to a readable date
var splitDate = $(this).val().split('/');
var readableDate = splitDate[2] + '-' + splitDate[0] + '-' + splitDate[1];
document.cookie = "agendadate=" + readableDate;
}
});
This approach allows me to set the datepicker to the saved date upon page refresh, improving user experience.
My concern now is: Does this method pose any risks for XSS or Session Hijacking?