tpruvot / fullcalendar

Year view implementation
http://epsy.ldtp.net/fullcalendar/demos/
MIT License
83 stars 26 forks source link

Wrong template when language and first day changing #25

Open afterlife88 opened 7 years ago

afterlife88 commented 7 years ago

When initialize calendar setup is Danish language and first day is Monday (1 in config) Then I want to change to English with first day 0. Year view is displaying wrong template (dates not starting from Sunday and still having same display as was at initialize step).

At initialize calendar: image View after changing on month view after recreation of calendar (Display as expected): image Year view is wrong: image

Code that using:

<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8' />
    <link href='../dist/fullcalendar.css' rel='stylesheet' />
    <link href='../dist/fullcalendar.print.css' rel='stylesheet' media='print' />
    <script src='../lib/moment/moment.js'></script>
    <script src='../lib/jquery/dist/jquery.js'></script>
    <script src='../dist/fullcalendar.js'></script>
    <script src='../dist/lang/da.js'></script>
    <script>
        $(document).ready(function() {

            calendarrender()

            $("#btn").click(function(){             
                $('#calendar').fullCalendar( 'destroy' );
                $('#calendar').fullCalendar({
                    header: {
                        left: 'prev,next today',
                        center: 'title',
                        right: 'year,month,agendaWeek,agendaDay'
                    },
                    lang: 'en',                 
                    firstDay: 0,
                });                
            });
            function calendarrender(){
                $('#calendar').fullCalendar({
                    header: {
                        left: 'prev,next today',
                        center: 'title',
                        right: 'year,month,agendaWeek,agendaDay'
                    },
                // defaultDate: '2015-01-12',
                defaultView: 'year',
                selectable: true,
                selectHelper: true,             
                lang: 'da',
                firstDay: 1,
                editable: true          
            })}});
        </script>
        <style>

            body {
                margin: 40px 10px;
                padding: 0;
                font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
                font-size: 14px;
            }

            #calendar {
                max-width: 900px;
                margin: 0 auto;
            }

        </style>
    </head>
    <body>
        <button type="submit" id="btn">click</button>
        <div id='calendar'></div>

    </body>
    </html>