daterangepickerbootstrap-daterangepicker

How to change Bootstrap daterangepicker language in the sidebar's selector


Im trying to change the language to Spanish using the locale property. This works fine, but I can only find the properties to translate only some of the strings.

As you can see in the image below, the months and weekdays are translated into Spanish, but the sidebar is not.

Is there any property to change these values?

Calendar

Locale property:

"locale": {
        "format": "MM/DD/YYYY",
        "separator": " - ",
        "applyLabel": "Aplicar",
        "cancelLabel": "Cancelar",
        "fromLabel": "Desde",
        "toLabel": "Hasta",
        "customRangeLabel": "Personalizado",
        "daysOfWeek": [
            "Lu",
            "Ma",
            "Mi",
            "Ju",
            "Vi",
            "Sá",
            "Do"
        ],
        "monthNames": [
            "Enero",
            "Febrero",
            "Marzo",
            "Abril",
            "Mayo",
            "Junio",
            "Julio",
            "Agusto",
            "Septiembre",
            "Octubre",
            "Noviembre",
            "Diciembre"
        ],
        "firstDay": 0
    }

Solution

  • I may be late to the game, but the ranges on the left are not defined in the locale.

    They are part of the parameters handed in ranges

      ranges: {
              'Heute': [moment(), moment()],
              'Gestern': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
              'Aktueller Monat': [moment().startOf('month'), moment().endOf('month')],
              'Letzter Monat': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
              'Januar 2019': [moment([2019,0]), moment(moment([2019,0]).endOf('month')) ],
              '1. Quartal 2019': [moment().quarter(1).startOf('quarter'), moment().quarter(1).endOf('quarter')],
              '2. Quartal 2019': [moment().quarter(2).startOf('quarter'), moment().quarter(2).endOf('quarter')],
              '3. Quartal 2019': [moment().quarter(3).startOf('quarter'), moment().quarter(3).endOf('quarter')],
              '4. Quartal 2019': [moment().quarter(4).startOf('quarter'), moment().quarter(4).endOf('quarter')]
            },
    

    BTW: I answered to your question not only but mostly because I was looking for exactly what you pasted in your question. So thanks for asking ;-)