komalbansal1991 / datejs

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

Uncaught RangeError: Maximum call stack size exceeded #143

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. $('#el').attr("title", DateTime);

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

The date parsed to string in some sort of default manner. (previously - Alpha, 
it had been the very long defaulty date string)
Uncaught RangeError: Maximum call stack size exceeded

What version of the product are you using? On what operating system?
Latest SVN of code as of 05/01/2011

Please provide any additional information below.

Uncaught RangeError: Maximum call stack size exceeded
$P.toString
$P.toString
$P.toString
$P.toString
$P.toString...

Original issue reported on code.google.com by philjor...@googlemail.com on 5 Jan 2012 at 3:53

GoogleCodeExporter commented 8 years ago
This also causes issues with other jQuery plugins (Datepicker, jquery-ui) that 
use the Date.toString() method.

The following code at the start of the toString() function seems to fix it and 
feels like a satisfactory default
if (format == undefined) format = 'u';

Original comment by philj...@hotmail.com on 9 Jan 2012 at 8:59

GoogleCodeExporter commented 8 years ago
Fix for this:

In the code that sets up the toString method:

Change 

Date.prototype._toString=Date.prototype.toString;

to

if(Date.prototype._toString==undefined) 
{Date.prototype._toString=Date.prototype.toString;}

Issue occurs when the internal function _toString gets set twice, once with the 
native implementation and then again with the DateJs implementation leading to 
infinite recursion of the toString function call. 

Original comment by afawc...@guardianglobalam.com on 10 Jan 2012 at 1:29

GoogleCodeExporter commented 8 years ago
Ok I have done some digging and yes you are correct that is indeed the solution 
cheers for pointing me right.
The original problem however came from my include of the core.js as well as the 
date.js, it appears on closer inspection they contain the same functionality so 
I will just remove core.js from my includes.

Original comment by philj...@hotmail.com on 10 Jan 2012 at 12:16

GoogleCodeExporter commented 8 years ago
Thanks for posting a fix!  I was going to have to abandon using date.js because 
of this! 

Original comment by jnelso...@gmail.com on 10 Feb 2012 at 5:39

GoogleCodeExporter commented 8 years ago
Actually changed the lines recommended, but that doesn't seem to fix it.  Still 
having the recursive issue.

Original comment by jnelso...@gmail.com on 10 Feb 2012 at 5:46

GoogleCodeExporter commented 8 years ago
Same problem for me after the fix

Original comment by Laur3nt....@gmail.com on 14 Feb 2012 at 3:23

GoogleCodeExporter commented 8 years ago
Thank you very much! You saved my life ^_^

Original comment by raqy.st...@gmail.com on 6 Jun 2012 at 7:58

GoogleCodeExporter commented 8 years ago
Thanks for the fix; I had an issue when using this with the jquery UI 
datepicker.  I had to change it twice, once in date.js and once in the 
date-nl-BE.js file.  

Original comment by benrobb...@gmail.com on 20 Jul 2012 at 9:23

GoogleCodeExporter commented 8 years ago
Ah yes I use the SVN Source rather than the release download, the two versions 
are fairly different, the source being more up to date amongst other things - 
there are also GitHub forks with various other fixes/updates.
The source has many files but no duplication i.e. the localisation files 
contain only the localisation - I then load just the localised version using 
require js - though any method would work.
The release style has 1 file per localisation with all the functionality 
duplicated - it means 1 file download for clients but if you need to make a 
change then you have to merge through the change to every localised version.
I prefer to use some other method of merging the files and keep the 
localisation separate.

Original comment by philjor...@googlemail.com on 21 Nov 2012 at 2:22

GoogleCodeExporter commented 8 years ago
Hey thanks for the fix, its really help full to me...............
Thanks a lot...

Original comment by abhi10...@gmail.com on 24 Jan 2013 at 11:27

GoogleCodeExporter commented 8 years ago
Is the fix on the svn ?
cause when I download datejs from svn, I read changelog.txt and last thing is :
2008-05-12 [geoffrey.mcgill]
Revision #191

Maybe the changelog.txt is not up to date ?

Original comment by nfourn...@ignition-factory.com on 5 Feb 2013 at 9:37

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I noticed I only get this issue if something is included twice.  For me it was 
because I compiled my assets (rails app) and forgot to clean them up

# this compiled them for me nicely for prod deployment
rake assets:precompile 

# clean up
rake assets:clean

Hope this helps

Original comment by mrgco...@gmail.com on 6 Mar 2013 at 3:27

GoogleCodeExporter commented 8 years ago
Thanks a lot! fixed my problem!

Original comment by sahar...@gmail.com on 10 Jul 2013 at 11:04

GoogleCodeExporter commented 8 years ago
fixed in my current fork:
https://github.com/abritinthebay/datejs/

Original comment by darkcr...@gmail.com on 14 Sep 2013 at 8:15

GoogleCodeExporter commented 8 years ago
Thanks, works for me!

Original comment by mmuci...@gmail.com on 25 Oct 2014 at 2:42