I have these two date time variables in javascript:
first_date = Date.parse('05/21/2012 0:00:00 '); second_date = Date.today();
If I use ( http://code.google.com/p/datejs/wiki/APIDocumentation#compareTo )
return first_date.compareTo(second_date)
an exception occurs:
Object function Date() { [native code] } has no method 'compareTo' in Google Chrome.
Object function Date() { [native code] } has no method 'compareTo'
I am using the latest version of Date.js from http://www.datejs.com/
How to solve this problem?
I mentioned that other functions (add (-5) .days (), today (), etc.) work fine.
PS: I looked here ( http://code.google.com/p/datejs/issues/detail?id=129 ), but not a workaround.
first_date and second_date are strings according to your code, and Date.compare doesn't even exist unless you use the svn-trunk version .
first_date
second_date
Date.compare
datejs defines Date.prototype.compareTo , so you can only use date_obj_a.compareTo(...) .
Date.prototype.compareTo
date_obj_a.compareTo(...)
first_date = Date.parse('05/21/2012 0:00:00 '); second_date = Date.today(); console.log(first_date.compareTo(second_date)); // just working fine
Source: https://habr.com/ru/post/1414305/More articles:How to get actions related to an object in Facebook Open Graph (knowing only the URL of the object)? - facebookhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1414301/kohana-32-session-expires-too-soon-shorter-expirations-work-as-expected&usg=ALkJrhi4ziIRFQDyy0uIfrlVssRE7ZpiFwAndroid xmpp library - javaProvide any literate Haskell in PDF, HTML or similar - haskellOPENGL Blending Function - Slow layer-level color swapping - openglIs Perl JOIN different? - arraysprocessing multi-component presentations in a Dreamweaver template in SDL Tridion 2011 - tridionI get LinkageError: poor main version at offset = 6, when deploying the application on S60 emulator - javacakephp web services how to write an action that allows me to upload a file - jsonHow to set border color for EditText for error checking - androidAll Articles