首页 > 解决方案 > maps.googleapis.com 与 date.js 不兼容

问题描述

最近遇到一个长期存在的asp.net c#程序的问题。

在我的 default.aspx 中,我们有...

<script src="https://maps.googleapis.com/maps/api/js?key=...&libraries=geometry"></script>

<script src="/js/date.js" type="text/javascript"></script>

date.js 是来自http://www.datejs.com/的实用程序库

就在最近(过去 6 周),我们的地图没有绘制任何东西,经过一番调查,似乎有一个toString()地图库文件试图使用toString()date.js 文件中的一个并且失败得很惨。

Uncaught TypeError: format.replace is not a function
    at Date.toString (date.js:40)
    at iq (common.js:65)
    at Object._.Bq (common.js:75)
    at map.js:83

目前我可以指定谷歌地图的版本,3.40 可以正常工作,以后的任何东西都不能。

有没有人对此有解决方案或有人看到过这个问题?授予 date.js 现在是非常古老的库,但我想知道是否有什么我可以做的。

标签: javascriptgoogle-maps-api-3incompatibility

解决方案


谷歌建议指向更新版本的 date.js https://github.com/datejs/Datejs/issues/88

我还没有检查它,但确认它使用旧的 date.js 失败


推荐阅读