Rename buttons DateRangePicker

0

I'm using Daterangepicker The problem is in English and I need to make some adjustments to Spanish:

How can I change the name of the option CustomRange and the name of the buttons Apply y Cancel . My current code:

var start = moment().subtract(29, 'days');
var end = moment();

function cb(start, end) {
    $('#reportrange_right span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
}

$('#reportrange_right').daterangepicker({
    startDate: start,
    endDate: end,
    ranges: {
       'Hoy': [moment(), moment()],
       'Ayer': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
       'Ultimos 7 dias': [moment().subtract(6, 'days'), moment()],
       'Ultimos 30 dias': [moment().subtract(29, 'days'), moment()],
       'Este mes': [moment().startOf('month'), moment().endOf('month')],
       'Mes pasado': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
    }
}, cb);

cb(start, end);

$('#reportrange_right').on('apply.daterangepicker', function(ev, picker) {
    //Cuando se selecciona una opcion 
});
    
asked by DoubleM 08.05.2018 в 05:05
source

1 answer

0

If you go to the page you can see that there is a menu that says Configuration Generator there, look for the local option, select it and you get out

locale": {
        "format": "MM/DD/YYYY",
        "separator": " - ",
        "applyLabel": "Apply",
        "cancelLabel": "Cancel",
        "fromLabel": "From",
        "toLabel": "To",
        "customRangeLabel": "Custom",

Change Apply and Cancel and Custom for anything you want and add it to the configuration array

    
answered by 08.05.2018 в 06:02