Okay
  Public Ticket #2757567
change datapicker
Closed

Comments

  • sistemeslinux started the conversation

    I would like to use Date Picker (disabled days Mo, We) in spanish, so week starts at monday, and if it's possible, how translate days and months is spanish.

    Thank you very much

  • [deleted] replied

    Hi sistemeslinux,

    In neon-custom.js (from line 703) you can change the date picker parameters to use Monday as week start:

    medium
    (view large image)

    weekStart: 1 // means week starts on monday
    To translate the calendar add these code in neon-custom.js file:

    medium
    (view large image)

    The complete code for that is located here:

    https://d.pr/n/oQBe6d

    I hope this helps you.

  • sistemeslinux replied

    Perfect Arlind... works perfect, thank yoy very much.

    Is possible to do the same with data range?

    Thank you!

  • [deleted] replied

    Hi sistemeslinux,

    Sorry for the delay of answer. To translate DateRangePicker add the "locale" property object in the initialization:

    $('#demo').daterangepicker({
        "locale": {
            "format": "MM/DD/YYYY",
            "separator": " - ",
            "applyLabel": "Apply",
            "cancelLabel": "Cancel",
            "fromLabel": "From",
            "toLabel": "To",
            "customRangeLabel": "Custom",
            "weekLabel": "W",
            "daysOfWeek": [
                "Su",
                "Mo",
                "Tu",
                "We",
                "Th",
                "Fr",
                "Sa"
            ],
            "monthNames": [
                "January",
                "February",
                "March",
                "April",
                "May",
                "June",
                "July",
                "August",
                "September",
                "October",
                "November",
                "December"
            ],
            "firstDay": 1
        },
        "linkedCalendars": false,
        "autoUpdateInput": false,
        "showCustomRangeLabel": false,
        "startDate": "05/13/2021",
        "endDate": "05/19/2021"
    }, function(start, end, label) {
      console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')');
    });
    
    To generate configuration you can use this link:

    https://www.daterangepicker.com/#config

  •   sistemeslinux replied privately
  • [deleted] replied

    Hi,

    Can you please add the "locale" property in neon-custom.js on line 873 like shown below:

    medium
    (view large image)

    So now it retrieves the localization:

    https://d.pr/v/cmvlhy