Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

configuring language in Bootstrap Date Range Picker

Tags:

I am using the Bootstrap Date Range Picker provided and explained In this page I added all the library using the cdn, I mean this:

<script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1/jquery.min.js"></script> <script type="text/javascript" src="//cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap/latest/css/bootstrap.css" /> <script type="text/javascript" src="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.css" /> 

But the thing is that I need all in spanish and I don´t see a piece of code to configurate it. How should I do it?

like image 454
Sredny M Casanova Avatar asked Dec 04 '15 01:12

Sredny M Casanova


People also ask

How do I customize DateRangePicker?

The DateRangePicker is available for UI customization based on your application requirements. It can be achieved by using renderDayCell event that provides an option to customize each day cell on rendering. The following example disables the weekends of every month by using renderDayCell event.

How do I set a datepicker range?

To set date range of one month from current date, we will use 'M' option to "+1" for maxDate and for minDate "0" So the current date becomes the value of minDate.


1 Answers

Include the locale option and edit the appropriate strings, like fromLabel or December :

$('#datePicker').daterangepicker({     "locale": {         "format": "MM/DD/YYYY",         "separator": " - ",         "applyLabel": "Apply",         "cancelLabel": "Cancel",         "fromLabel": "From",         "toLabel": "To",         "customRangeLabel": "Custom",         "daysOfWeek": [             "Su",             "Mo",             "Tu",             "We",             "Th",             "Fr",             "Sa"         ],         "monthNames": [             "January",             "February",             "March",             "April",             "May",             "June",             "July",             "August",             "September",             "October",             "November",             "December"         ],         "firstDay": 1     } }) 

here is a demo with spanish month names -> http://jsfiddle.net/r21747qc/

like image 182
davidkonrad Avatar answered Sep 23 '22 23:09

davidkonrad