This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

dhb528693
dhb528693

My ongoing project, I use datepicker formwidget (using Picaday), And I change vendor/picaday/js/picaday.js,

    // internationalization
    //i18n: {
    //    previousMonth : 'Previous Month',
    //    nextMonth     : 'Next Month',
    //    months        : ['January','February','March','April','May','June','July','August','September','October','November','December'],
    //    weekdays      : ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
    //    weekdaysShort : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
    //},

and I run: php artisan october:util compile assets.

It works fine,

But changing the code inside of modules seems not a good approach, Is there any better way to do this? Further more, any idea to work with i18n for rechedit formwidget.

ukebako8008
ukebako8008

You can override pikaday configuration from javascript after it's initialised:

$(document).ready(function () {
    $('[data-control="datepicker"] input').each(function () {
            $(this).data().pikaday.config({
                i18n: {
                    previousMonth : 'Пред. Месяц',
                    nextMonth     : 'След. Месяц',
                    months        : ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"],
                    weekdays      : ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"],
                    weekdaysShort : ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"]
                },
                firstDay: 1, // Monday
            });
    });
});

Last updated

angelside
angelside

It's have a error, but somehow working on first datepicker input. I am play all arround, trying extend october's datepicker.js but I could not do it.

Uncaught TypeError: Cannot read property 'config' of undefined
    at HTMLInputElement.<anonymous> (datepicker.js:12)
    at Function.each (jquery.min.js?v403:2)
    at n.fn.init.each (jquery.min.js?v403:2)
    at HTMLDocument.<anonymous> (datepicker.js:6)
    at j (jquery.min.js?v403:2)
    at Object.fireWith [as resolveWith] (jquery.min.js?v403:2)
    at Function.ready (jquery.min.js?v403:2)
    at HTMLDocument.I (jquery.min.js?v403:2)

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.