如何在bootstrap日历中将英文格式日期更改为西班牙语?

时间:2015-09-06 13:02:12

标签: javascript html twitter-bootstrap calendar

我有一个引导程序日历,它以英文格式显示日期和月份。

我尝试更改名称以进行翻译:

.tile {
  &-1-3 {
    width: decimal-ceil(100/3, 5);
    // this should result as 33.33334%;
  }
  &-2-3 {
    width: 2/3 * 100%;
  }
  &-1-1 {
    width: 3/3 * 100%;
  }
}

但是我想在周一的第一天显示星期一而不是星期天。

我尝试添加:

 $('#calendar').fullCalendar({
     monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
    monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'],
 dayNames: ['Domingo','Lunes', 'Martes','Miércoles','Jueves', 'Viernes','Sábado'],
 dayNamesShort: ['Dom', 'Lun', 'Mar','Mier','Jue', 'Vie','Sab'],
    header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,agendaWeek,agendaDay'
    },
    editable: true
});
});

 lang: 'es'

不显示日历......

如何更改此格式?

谢谢!

1 个答案:

答案 0 :(得分:0)

将此内容与您的西班牙语脚本一起使用:https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.4.0/lang/es.js

 $('#calendar').fullCalendar({
   header: {
     left: 'prev,next today',
     center: 'title',
     right: 'month,agendaWeek,agendaDay'
   },
   defaultDate: '2015-09-1',
   editable: true,
   eventLimit: true // allow "more" link when too many events
 });
body {
  margin: 40px 1px;
  padding: 0;
  font-family: "Lucida Grande", Helvetica, Arial, Verdana, sans-serif;
  font-size: 14px;
}
#calendar {
  max-width: 900px;
  margin: 0 auto;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.4.0/fullcalendar.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.4.0/fullcalendar.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.4.0/lang/es.js"></script>
<div id='calendar'></div>