最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - maps.googleapis.com incompatible with date.js - Stack Overflow

programmeradmin4浏览0评论

Recently encountered a problem with a long standing asp c# program.

In my default.aspx amongst other things we have...

<script src="=...&libraries=geometry"></script>

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

date.js is a utility library from /

Just recently (last 6 weeks) our map is failing to draw anything, after a bit of investigation it seems that there's a toString() in one of the maps library files that tries to use the toString() from the date.js file and fails miserably.

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

For the moment I can specify the version of google maps, 3.40 works fine, anything later doesn't.

Does anyone have a solution to this or has anyone seen this problem? Granted date.js is very old library now but I wondered if there's anything simply I can do.

Recently encountered a problem with a long standing asp c# program.

In my default.aspx amongst other things we have...

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

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

date.js is a utility library from http://www.datejs./

Just recently (last 6 weeks) our map is failing to draw anything, after a bit of investigation it seems that there's a toString() in one of the maps library files that tries to use the toString() from the date.js file and fails miserably.

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

For the moment I can specify the version of google maps, 3.40 works fine, anything later doesn't.

Does anyone have a solution to this or has anyone seen this problem? Granted date.js is very old library now but I wondered if there's anything simply I can do.

Share Improve this question edited Aug 4, 2020 at 21:31 Sascha A. 4,6363 gold badges16 silver badges34 bronze badges asked Aug 4, 2020 at 21:10 Richard NixonRichard Nixon 8476 silver badges9 bronze badges 2
  • 1 related question: format.replace is not a function - google-maps – geocodezip Commented Aug 4, 2020 at 21:29
  • Forcing the version works for now. One solution for the future is to rename the now() function in date.js and change usages in the code we do control. The underlying problem is that date.js changes the return result type of the now() function. – Richard Nixon Commented Aug 23, 2020 at 18:54
Add a ment  | 

3 Answers 3

Reset to default 4

Google suggests pointing to a more recent version of date.js https://github./datejs/Datejs/issues/88

I haven't checked it yet but confirmed it is failing with an old date.js

I am also getting the same error in version 3.41, but after changing it to version 3.40, It works!

Ran into this same issue in a Rails app, updating data.js to a more recent version fixed it. There's a more recent fork that's available here that fixed the issue for me: https://github./abritinthebay/datejs

发布评论

评论列表(0)

  1. 暂无评论