问题描述
这个问题我看到的是在Mozilla,但在IE浏览器正常工作
我有这在我的_calendar.cshtml上的document.ready局部视图
I have this in my _calendar.cshtml partial view on document.ready
$.ajax({
type: "POST",
contentType: "application/json",
data: "{}",
url: "/Home/GetEvents",
dataType: "json",
success: function (data) {
$('#calendar').fullCalendar({
editable: false,
eventColor: '#F09A18',
textColor: 'white',
lang: 'en-IN',
eventLimit: 1,
eventLimitText: 'More',
weekMode: 'liquid',
events: $.map(data, function (item, i) {
var event = new Object();
event.start = new Date(item.StartDate);
event.title = item.EventName;
event.brief = item.EventBrief;
return event;
}),
});
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
$("#cal_error").text(errorThrown);
}
});
这使得事件,如果我不包括在以下web.config文件件code的
It renders events if I don't include below piece of code in web.config file
<globalization culture="en-IN" uiCulture="en-IN"/>
我也试图保持
<globalization culture="auto" uiCulture="auto"/>
但没有任何变化。 当我包括全球化在web.config中的事件不能在Firefox在所有的显示,但仍然他们将在IE中正常工作。
下面是我内定fullcalendar.js
below are my defaults in fullcalendar.js
titleRangeSeparator: ' \u2014 ', // emphasized dash
monthYearFormat: 'MMMM YYYY', // required for en. other languages rely on datepicker computable option
defaultTimedEventDuration: '02:00:00',
defaultAllDayEventDuration: { days: 1 },
forceEventDuration: false,
nextDayThreshold: '09:00:00', // 9am
// display
defaultView: 'month',
aspectRatio: 1.35,
header: {
left: 'title',
center: '',
right: 'today prev,next'
},
weekends: true,
weekNumbers: false,
weekNumberTitle: 'W',
weekNumberCalculation: 'local',
//editable: false,
// event ajax
lazyFetching: true,
startParam: 'start',
endParam: 'end',
timezoneParam: 'timezone',
timezone: 'local',
//allDayDefault: undefined,
// locale
isRTL: false,
defaultButtonText: {
prev: "prev",
next: "next",
prevYear: "prev year",
nextYear: "next year",
today: 'today',
month: 'month',
week: 'week',
day: 'day'
},
buttonIcons: {
prev: 'left-single-arrow',
next: 'right-single-arrow',
prevYear: 'left-double-arrow',
nextYear: 'right-double-arrow'
},
// jquery-ui theming
theme: false,
themeButtonIcons: {
prev: 'circle-triangle-w',
next: 'circle-triangle-e',
prevYear: 'seek-prev',
nextYear: 'seek-next'
},
dragOpacity: .75,
dragRevertDuration: 500,
dragScroll: true,
//selectable: false,
unselectAuto: true,
dropAccept: '*',
eventLimit: false,
eventLimitText: 'more',
eventLimitClick: 'popover',
dayPopoverFormat: 'LL',
handleWindowResize: true,
windowResizeDelay: 200 // milliseconds before an updateSize happens
会发生什么fullcalendar当我包括全球化的标签。我也试图设置时区为本地 UTC 假的默认值,但即使没有工作?谁能帮助我如何解决此问题?
What happens to fullcalendar when I include globalization tag. I have also tried setting timeZone to 'local', 'UTC', false in defaults but even that did not work? can anyone help me how to solve this?
推荐答案
确定。谷歌搜索了这么多之后,我找到了答案这一点。
Ok. After googling so much I found out answer for this.
我只需要按照下面的事件设置日期:
I just need to set date as below for the events:
events: $.map(data, function (item, i) {
var event = new Object();
event.start = moment(item.StartDate).utc();
event.title = item.EventName;
event.brief = item.EventBrief;
return event;
}),
这工作就像一个奇迹。但我要保持我的web.config文件,如下
This worked like a miracle. But I have to keep my web.config file as below
<globalization culture="auto" uiCulture="auto"/>
而不是&LT;全球化文化=EN-IN的UICulture =EN-IN/&GT;
当我把它作为文化=EN-IN,即使我用那一刻,它不会工作转换日期对象。还是搞清楚为什么,但对于目前上述方案解决了。
When I keep it as culture="en-IN" even though I convert date object using moment it will not work. Still figuring out why but for time being the above solution works out.
这篇关于为什么全球化在web.config中做fullcalendar不渲染事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!