2013-02-18 47 views
1

我正在嘗試設置YUI日曆。設置YUI日曆插件的時區

問題:由於最終用戶位於不同的時區,因此當他們選擇今天的日期時,他們會根據他們的時區看到不同的日期。

以下是我的代碼

<html> 
<head> 
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/fonts/fonts-min.css" /> 
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/calendar/assets/skins/sam/calendar.css" /> 
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script> 
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/calendar/calendar-min.js"></script> 
</head> 
<body class="yui-skin-sam"> 
<div class="exampleIntro"> 
</div> 

<div id="cal1Container"></div> 

<div style="clear:both" ></div> 

<!--END SOURCE CODE FOR EXAMPLE =============================== --> 
<script type="text/javascript"> 
    YAHOO.namespace("example.calendar"); 

    YAHOO.example.calendar.init = function() { 
     YAHOO.example.calendar.cal1 = new YAHOO.widget.Calendar("cal1","cal1Container"); 
     YAHOO.example.calendar.cal1.render(); 
    } 

    YAHOO.util.Event.onDOMReady(YAHOO.example.calendar.init); 
</script> 

</body> 
</html> 

我沒有找到配置參數,在那裏我可以爲日曆設置時區。

回答

0

我不認爲YUI日曆支持時區。 JavaScript本身不支持時區。每當我遇到這個問題時,我都會避免使用Date類,將日期作爲字符串發送到服務器,並處理服務器上的時區。