error in full Legend

Asked

Viewed 574 times

-1

I have a complete calendar and when I change the language to Portuguese, it returns me this error. Uncaught Typeerror: Cannot read Property 'defineLocale' of Undefined

   $('#calendar').fullCalendar({
                header: {
                    left: 'prev,next today',
                    right: 'month,agendaWeek'
                },
                defaultView: 'month',
                viewRender: function (view) {
                    var title = view.title;
                    $(".taskElementCalendar").html(title);
                }
            });

            $(".taskElementPrev").click(function () {
                $("#calendar").fullCalendar('prev');
            });
            $(".taskElementNext").click(function () {
                $("#calendar").fullCalendar('next');
            });
            $(".taskElementToday").click(function () {
                $("#calendar").fullCalendar('today');
            })

1 answer

0


You have correctly imported the specific locale?

According to the documentation:

How to use other locales

You will need to load the locale Javascript data file in order to use it. These files are included with the Fullcalendar download in the locale/ directory. They must be Loaded via a tag after the main Fullcalendar library is Loaded.

<script src='fullcalendar/fullcalendar.js'></script>
<script src='fullcalendar/locale/es.js'></script>
<script>

    $(document).ready(function() {

        $('#calendar').fullCalendar({
        });

    });

</script>

If you import the specific locale, you don’t need to pass any options.

Now if you import the JS file that has all the locations, then you can put the options locale when you are starting fullCalendar.

It would look something like this:

<script src='fullcalendar/fullcalendar.js'></script>
<script src='fullcalendar/locale-all.js'></script>
<script>

    $(document).ready(function() {

        $('#calendar').fullCalendar({
            locale: 'es'
        });

    });

</script>

I hope I helped. Any questions, just comment.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.