I am using jQuery UI DateRangePicker (reference). I would like this daterangepicker available in 3 languages (nl, fr and en).
I will be using a switch statement to set the settings for the calendar.
switch(curr_lang) {
case 'nl':
moment.locale('nl');
var daterangepicker = $("#search-vac-daterange").daterangepicker(
{
initialText : 'Selecteer datums',
dateFormat: 'd MM yy',
datepickerOptions: {
minDate: new Date(),
startDate: new Date(),
maxDate: '+2y'
},
presetRanges: [{
text: 'Vandaag',
dateStart: function() { return moment() },
dateEnd: function() { return moment() }
}, {
text: 'Volgende 7 dagen',
dateStart: function() { return moment() },
dateEnd: function() { return moment().add(7, 'days') }
}, {
text: 'Volgende 30 dagen',
dateStart: function() { return moment() },
dateEnd: function() { return moment().add(30, 'days') }
}, {
text: 'Volgende 6 maanden',
dateStart: function() { return moment()},
dateEnd: function() { return moment().add(6, 'months') }
}, {
text: 'Volgend jaar',
dateStart: function() { return moment() },
dateEnd: function() { return moment().add(1,'years') }
}]
}
);
break;
}
The date appears as
18 January 2019 - 17 February 2019
The locale set with moment is not being picked up, and the result is always in English (default).
NOTE: I did not manage to get the minDate and startDate to work with moment(), so if anyone has a clue for this. Please help me out!