shal19 / datejs

Automatically exported from code.google.com/p/datejs
Other
0 stars 0 forks source link

Conflict with Google Maps search bar #96

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Include datejs library
2. Include a google maps canvas
3. Enable google bar

What is the expected output? What do you see instead?

Search in google bar should work, but it does nothing. This is the error 
which is printed in the browser console:

format.replace is not a function
[Break on this error] return 
w;};Date.prototype.isDST=function...ase"z":return"";}}):this._toString();};\n

Please provide any additional information below.

The problem is that you are modifying the global Date, adding a 
toString(format) method to it. Then Google guys do the same, and there is 
a conflict.

Original issue reported on code.google.com by webspect...@gmail.com on 16 Feb 2010 at 8:23

GoogleCodeExporter commented 8 years ago
I am using date.js library Version: 1.0 Alpha-1 Build Date: 13-Nov-2007
I noticed that when I was trying to add Google Translation Javascript 
functionality by adding the below code in the html page, somehow date.js was 
getting called and there was error as seen through Firebug log.

TypeError: format.replace is not a function
[Break On This Error]   

...rn(s.toString().length==1)?"0"+s:s;};return 
format?format.replace(/dd?d?d?|MM?M?...
date.js(line 40)

<meta name="google-translate-customization" 
content="c3f9fbc48648709e-5efe400668482c85-gda15035a365e5911-1b"></meta>
<script type="text/javascript">
    function googleTranslateElementInit() {
      new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
    }
</script><script type="text/javascript" 
src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit
"></script>

Similar code one can generate by registering some dummy website in the Google 
Translate My Page website http://translate.google.com/translate_tools

Original comment by anupam...@gmail.com on 6 Jun 2013 at 11:35

GoogleCodeExporter commented 8 years ago
I'm getting the same error? Did you find a solution?

Original comment by goo...@traveling.lk on 1 Nov 2013 at 10:25

GoogleCodeExporter commented 8 years ago
Any luck with this error, I am still facing the same problem with Google 
Translate and Date.js . TypeError: format.replace is not a function

Original comment by kidb...@gmail.com on 6 Jan 2015 at 4:28