I am playing with full calendar and I need change the locale.
When I try to do it. I get an error.
What script do I have to add to get rid off the error?
Chrome dev - error:
pt-br.js:1 Uncaught TypeError: Cannot read property 'datepickerLocale' of undefined
I have used:
html:
<div id='calendar'></div>
JS:
<script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/locale/pt-br.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.1.0/fullcalendar.print.css">
<script type="text/javascript">
$(document).ready(function() {
// page is now ready, initialize the calendar...
$('#calendar').fullCalendar({
// put your options and callbacks here
locale: 'pt-br'
})
});
</script>
The locale file needs fullcalendar to be present already.
Load the locale file after loading fullcalendar itself.
i think the full calendar is not called correctly. It expects a setting or options object.
Try calling it inside document ready object, by
(function($){
$(function(){
// rest of the code here
})
})(jQuery)
Posting this as my solution was different....
using fullCalendar 3.0.9.2 (latest version as of today), I kept getting the same error
Cannot read property 'datepickerLocale' of undefined
Making sure the locale file was after the .js didn't help
DOES NOT WORK
<script src="path_to_js/fullcalendar.min.js"></script>
<script src="path_to_js/locale-all.js"></script>
DOES WORK
<script src="path_to_js/fullcalendar.js"></script>
<script src="path_to_js/locale-all.js"></script>
The difference is in the use of the 'min' version - went to the full version and all looks/works great.
It might also be that I'm using the 'locale-all' file instead of a single one. Not all combinations tested, though you can't argue with success!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.