2

I was looking through some pages when I stumbled across this open source JavaScript date library: Datejs. Now I've been trying to use it but everytime I try any function like:

$(function() { Date.today().toLongDateString() } );

or even only

Date.today().toLongDateString()

withing tags, I get errors when the webpage loads, it tells me Date.today() is not a function but it appears as such in the documentation I've been at this for like almost 2 hours now xD it's driving me crazy and I know I just probably overlooked something...

I loaded the:

<script type="text/javascript" src="assets/js/dia_hora/date_es-MX.js"></script>
1
  • Do you have the latest release? Commented Sep 8, 2011 at 13:57

4 Answers 4

2

Are your script path and filename correct? You wrote:

<script type="text/javascript" src="assets/js/dia_hora/date_es-MX.js"></script>

But according to the "Getting Started" page of the project, it should be:

<script type="text/javascript" src="assets/js/dia_hora/date-es-MX.js"></script>

There are two hyphens in the original file: "date-es-MX.js", not an underscore. Or did you rename the file?

Check if the file correctly loads using Firefox Firebug (network tab) or FiddlerTool if you're using Internet Explorer.

Sign up to request clarification or add additional context in comments.

Comments

0

Sounds like the script is not getting loaded. Put an alert('hello'); at the beginning of the script and see if you get that popup when the page loads.

3 Comments

Try making a call to DateJS without first loading the jQuery libs, maybe jQuery is interfering?
nope, I removed the jQuery file, still nothing =( I could actually write the js myself since it's not that difficult, but I don't know how to append it on the fly to the spot where I want it
Try posting your problem on the datejs mailing list at groups.google.com/group/datejs/topics?pli=1 . Put in a link to this question, I must admit it does seem rather odd that it's failing as you described. Someone there should be able to help you.
0

Your path to the javascript file is incorrect.

OR

You have a syntax error in a Javascript file that is being loaded before this one. I believe the browser will stop trying to interpret the rest of the Javascript as soon as an error occurs.

Comments

0

Try having the JS Console open in Chrome or Firefox or Safari - you will get a much better idea of what the error is. JS Console has saved me hours or even days - I remember how I used to get frustrated about not being able to tell what happened when JS silently failed. But with JS Console it's never a silent fail - you get some hint in the error message however small.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.