我在devextreme中使用dxdatebox。在询问我终于在dxdatebox中实现了德国日历之后。现在我想要一个波斯日历,我已经尝试过了:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>DevExtreme Sample</title>
<link rel="stylesheet" type="text/css" href="~/css/dx.common.css" />
<link rel="stylesheet" type="text/css" href="~/css/dx.light.css" />
<script type="text/javascript" src="~/js/jquery-2.2.3.min.js"></script></script>
<script type="text/javascript" src="~/js/cldr.min.js"></script>
<script type="text/javascript" src="~/js/cldr/event.min.js"></script>
<script type="text/javascript" src="~/js/cldr/supplemental.min.js"></script>
<script type="text/javascript" src="~/js/globalize.min.js"></script>
<script type="text/javascript" src="~/js/globalize/message.min.js"></script>
<script type="text/javascript" src="~/js/globalize/number.min.js"></script>
<script type="text/javascript" src="~/js/globalize/currency.min.js"></script>
<script type="text/javascript" src="~/js/globalize/date.min.js"></script>
<script type="text/javascript" src="~/js/dx.all.js"></script>
@*<script type="text/javascript" src="~/js/localization/dx.all.de.js"></script>*@
</head>
<body>
<div id="btnContainer"></div>
<div id="dateContainer"></div>
<script>
$.when(
$.getJSON("../cldr/main/fa/ca-persian.json"),
$.getJSON("../cldr/main/fa/numbers.json"),
$.getJSON("../cldr/main/fa/currencies.json"),
$.getJSON("../cldr/supplemental/likelySubtags.json"),
$.getJSON("../cldr/supplemental/timeData.json"),
$.getJSON("../cldr/supplemental/weekData.json"),
$.getJSON("../cldr/supplemental/currencyData.json"),
$.getJSON("../cldr/supplemental/numberingSystems.json")
).then(function () {
return [].slice.apply(arguments, [0]).map(function (result) {
return result[0];
});
}).then(
Globalize.load
).then(function () {
Globalize.locale('fa');
$('#dateContainer').dxDateBox({
value: new Date(),
});
});
</script>
</body>
</html>
但在控制台中我收到此错误:Unsupported {"feature":"Julian day pattern
g "}.
如何将格里高利日历转换为朱利安日历?
答案 0 :(得分:0)
不了解你的框架,但更普遍的是
这样:https://github.com/kbwood/calendars 你可以这样做:
var d = $.calendars.newDate(1385, 6, 2, 'persian', 'fa');
console.log("Persian date: "+d.toLocaleString());
var e = d.toJSDate();
console.log(e);
答案 1 :(得分:0)
您不能使用globalize.js,因为它不支持fa-IR语言环境。 您必须切换到INTL方法: https://js.devexpress.com/Documentation/Guide/Common/Localization/#Localize_Dates_Numbers_and_Currencies/Using_Intl