我有 ASP.NET MVC 5 应用程序,我的全球化/验证(Globalize 1.2.2)负载是:
<script src="~/Scripts/cldr.js"></script>
<script src="~/Scripts/cldr/event.js"></script>
<script src="~/Scripts/cldr/supplemental.js"></script>
<script src="~/Scripts/globalize.js"></script>
<script src="~/Scripts/globalize/number.js"></script>
<script src="~/Scripts/globalize/date.js"></script>
<script src="~/Scripts/jquery.validate.js"></script>
<script src="~/Scripts/jquery.validate.globalize.js"></script>
<script type="text/javascript">
$.when(
$.getJSON("@Url.Content("~/Scripts/cldr/supplemental/likelySubtags.json")"),
$.getJSON("@Url.Content("~/Scripts/cldr/supplemental/numberingSystems.json")"),
$.getJSON("@Url.Content("~/Scripts/cldr/supplemental/timeData.json")"),
$.getJSON("@Url.Content("~/Scripts/cldr/supplemental/weekData.json")"),
$.getJSON("@Url.Content("~/Scripts/cldr/main/en/numbers.json")"),
$.getJSON("@Url.Content("~/Scripts/cldr/main/en/ca-gregorian.json")"),
$.getJSON("@Url.Content("~/Scripts/cldr/main/en/timeZoneNames.json")"),
$.getJSON("@Url.Content("~/Scripts/cldr/main/sr-Latn/numbers.json")"),
$.getJSON("@Url.Content("~/Scripts/cldr/main/sr-Latn/ca-gregorian.json")"),
$.getJSON("@Url.Content("~/Scripts/cldr/main/sr-Latn/timeZoneNames.json")")
).then(function () {
console.log("start slicing");
return [].slice.apply(arguments, [0]).map(function (result) {
console.log("slicing done");
return result[0];
});
}).then(Globalize.load).then(function () {
Globalize.locale('sr-Latn');
}).then(console.log("LOADED EVERYTHING"));
</script>
但是现在,当我尝试在浏览器调试器中进行测试时,命令:
Globalize.formatDate(new Date(), {datetime:"long"});
给出意想不到的结果。取而代之的是冒号作为时间分隔符,我得到了一个点:“2017 年 1 月 16 日。07.57.17 GMT+1”。JSON 存储库在“timeFormats”和“dateTimeFormats”模式中看起来不错。“en”或“de”一切正常,它们在存储库中定义了类似的时间和日期模式。
我哪里错了?