By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,955 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,955 IT Pros & Developers. It's quick & easy.

[LINK] Datejs - A JavaScript Date Library

P: n/a
I'm REALLY liking this so far. And for those who welcome something a
little less cryptic than what the resident date guru offers, here's a
chance to try something fairly elegant and definitely unique.

http://www.datejs.com/

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Dec 5 '07 #1
Share this Question
Share on Google+
34 Replies


P: n/a
On Dec 5, 4:37 am, "-Lost" <maventheextrawo...@techie.comwrote:
I'm REALLY liking this so far. And for those who welcome something a
little less cryptic than what the resident date guru offers, here's a
chance to try something fairly elegant and definitely unique.

http://www.datejs.com/
I visited it using IE6 and just typing in the demo's textbox threw a
script error. Typing one of the suggested strings (last April) and
hitting enter just refreshed the page.

Looking at the code for the lib itself, I see lots of try/catch
clauses, which will cause the script to fail in older browsers. It
also uses Function.call in places, so it doesn't appear that it was
written with compatibility in mind. I haven't looked at the code
posted by the "resident date guru", but cryptic as it may be, I doubt
it has these sorts of issues.
Dec 5 '07 #2

P: n/a
On Dec 5, 10:32 pm, David Mark <dmark.cins...@gmail.comwrote:
On Dec 5, 4:37 am, "-Lost" <maventheextrawo...@techie.comwrote:
I'm REALLY liking this so far. And for those who welcome something a
little less cryptic than what the resident date guru offers, here's a
chance to try something fairly elegant and definitely unique.
http://www.datejs.com/

I visited it using IE6
I tried in Safari and Firefox, neither managed to load the page.
Great advertisement!
--
Rob
Dec 5 '07 #3

P: n/a
On Dec 5, 7:57 am, RobG <rg...@iinet.net.auwrote:
On Dec 5, 10:32 pm, David Mark <dmark.cins...@gmail.comwrote:
On Dec 5, 4:37 am, "-Lost" <maventheextrawo...@techie.comwrote:
I'm REALLY liking this so far. And for those who welcome something a
little less cryptic than what the resident date guru offers, here's a
chance to try something fairly elegant and definitely unique.
>http://www.datejs.com/
I visited it using IE6

I tried in Safari and Firefox, neither managed to load the page.
Great advertisement!
They apparently spent all of their development time working on that
half-page graphic at the top. Other than the home page, the rest of
the site throws DNS errors. Odd as they are on the same server. As
for not loading in Safari and Firefox, this looks like a telling
indicator:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">

Suffice to say that the author is equally clueless with markup and
script.

Avoid like the plague.
Dec 5 '07 #4

P: n/a
David Mark said the following on 12/5/2007 7:32 AM:
On Dec 5, 4:37 am, "-Lost" <maventheextrawo...@techie.comwrote:
>I'm REALLY liking this so far. And for those who welcome something a
little less cryptic than what the resident date guru offers, here's a
chance to try something fairly elegant and definitely unique.

http://www.datejs.com/

I visited it using IE6 and just typing in the demo's textbox threw a
script error.
Same thing in IE7:

Invalid procedure call or argument.
Typing one of the suggested strings (last April) and
hitting enter just refreshed the page.
"Last April", in Firefox, gives me:

Thursday, April 05, 2007 0:00:00 AM

Not a lot of use in that. I would have expected, at least, the First of
April, not the Fifth. I know why it did, but, if it is going to give the
Fifth of April on the Fifth of December, it should give me the time as
it is now, not 0:00:00 AM.
I haven't looked at the code posted by the "resident date guru", but
cryptic as it may be, I doubt it has these sorts of issues.
The major problem with John's code is that it is so cryptic that it is
almost impossible to read/understand it unless you already know what it
does and if you know what it does, then you don't need his code.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 5 '07 #5

P: n/a
Response to RobG <rg***@iinet.net.au>:
On Dec 5, 10:32 pm, David Mark <dmark.cins...@gmail.comwrote:
>On Dec 5, 4:37 am, "-Lost" <maventheextrawo...@techie.comwrote:
I'm REALLY liking this so far. And for those who welcome
something a little less cryptic than what the resident date
guru offers, here's a chance to try something fairly elegant
and definitely unique.
>http://www..com/

I visited it using IE6

I tried in Safari and Firefox, neither managed to load the page.
Great advertisement!
Ugh! Sorry, guys!

I should have mentioned that "liking this so far" was 5 minutes worth
of perusal and me viewing in Firefox 2.0.0.9 Windows, only.

I'll pay better attention in the future. Sure would have been nice
too, it seemed really responsive in my test case.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Dec 5 '07 #6

P: n/a
Response to Randy Webb <Hi************@aol.com>:
David Mark said the following on 12/5/2007 7:32 AM:
>On Dec 5, 4:37 am, "-Lost" <maventheextrawo...@techie.comwrote:
>>I'm REALLY liking this so far. And for those who welcome
something a little less cryptic than what the resident date guru
offers, here's a chance to try something fairly elegant and
definitely unique.

http://www..com/

I visited it using IE6 and just typing in the demo's textbox
threw a script error.

Same thing in IE7:

Invalid procedure call or argument.
Bah, I didn't even bother to look at the source code. I allowed the
damned demo to impress me far more than it should have.

The points David Mark made in the code alone would have been enough
for me not to suggest it (had I paid attention).
>Typing one of the suggested strings (last April) and
hitting enter just refreshed the page.

"Last April", in Firefox, gives me:

Thursday, April 05, 2007 0:00:00 AM
Hrmm... one of the ones I didn't plug in. It gets worse too.

"last April now" yields "Wednesday, December 05, 2007 3:20:46 PM"

Whereas I thought it MIGHT more closely resemble "Thursday, April 05,
2007 3:30:46 PM."

Instead it appears to slaughter all but the last thing it recognizes.

<snip>
>I haven't looked at the code posted by the "resident date guru",
but cryptic as it may be, I doubt it has these sorts of issues.

The major problem with John's code is that it is so cryptic that
it is almost impossible to read/understand it unless you already
know what it does and if you know what it does, then you don't
need his code.
Exactly. And the time it takes to learn from said code makes it
counterproductive as a learning tool.

Anyway, in regards to this link -- sorry I even posted it! I didn't
realize that it was already in such a poor state of development. I
should have checked more.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Dec 5 '07 #7

P: n/a
-Lost said the following on 12/5/2007 3:27 PM:
Response to Randy Webb <Hi************@aol.com>:
>David Mark said the following on 12/5/2007 7:32 AM:
<snip>
>>I haven't looked at the code posted by the "resident date guru",
but cryptic as it may be, I doubt it has these sorts of issues.
The major problem with John's code is that it is so cryptic that
it is almost impossible to read/understand it unless you already
know what it does and if you know what it does, then you don't
need his code.

Exactly. And the time it takes to learn from said code makes it
counterproductive as a learning tool.
That is why I have not even looked at code on his site in over 5 years.
It was quicker, easier, and more productive to forget about his site and
learn it myself.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 5 '07 #8

P: n/a
In comp.lang.javascript message <Xn*************************@216.196.97.
136>, Wed, 5 Dec 2007 03:37:44, -Lost <ma****************@techie.com>
posted:
>I'm REALLY liking this so far. And for those who welcome something a
little less cryptic than what the resident date guru offers, here's a
chance to try something fairly elegant and definitely unique.

http://www.datejs.com/
Is it your own work? I don't know yet because I get a IE6 runtime error
in line 9 on trying to access the page ...

And every time I type a character in the box I get another error, line
15. I've typed the date; nothing happens. Is Enter expected? Seems
so, but that gives more errors and back to square one.

Opera Ctrl-Alt-V on that page - W3 gives 17 errors and very many
warnings.

Opera will accept the suggested 6/4/2005 but misinterprets it as FFF.

It can't handle Ramadan or Good Friday, though; nor next friday.

It accepts 2, but not -2.
NEVER use code from an anonymous source.

--
(c) John Stockton, Surrey, UK. ??*@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.
Check boilerplate spelling -- error is a public sign of incompetence.
Never fully trust an article from a poster who gives no full real name.
Dec 5 '07 #9

P: n/a
Response to Dr J R Stockton <jr*@merlyn.demon.co.uk>:
>>http://www..com/

Is it your own work? I don't know yet because I get a IE6 runtime
error in line 9 on trying to access the page ...
Nope.

<snip problems>

Yeah, after further review of the code (mainly by others) it appears it
is much crappier than I previously thought.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Dec 6 '07 #10

P: n/a
In comp.lang.javascript message <Xn*************************@216.196.97.
136>, Wed, 5 Dec 2007 14:18:20, -Lost <ma****************@techie.com>
posted:
>
I should have mentioned that "liking this so far" was 5 minutes worth
of perusal and me viewing in Firefox 2.0.0.9 Windows, only.
You are using an out-of-date version.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20 ; WinXP.
Web <URL:http://www.merlyn.demon.co.uk/- FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm- also batprogs.htm.
Dec 6 '07 #11

P: n/a
Response to Dr J R Stockton <jr*@merlyn.demon.co.uk>:
In comp.lang.javascript message
<Xn*************************@216.196.97. 136>, Wed, 5 Dec 2007
14:18:20, -Lost <ma****************@techie.composted:
>>
I should have mentioned that "liking this so far" was 5 minutes
worth of perusal and me viewing in Firefox 2.0.0.9 Windows, only.

You are using an out-of-date version.
Jeez, I am aren't I? Seems like as soon as I get the browser
configured here comes another update.

Ah well, continual updates cannot be a bad thing.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Dec 6 '07 #12

P: n/a
coolgeoff said the following on 12/13/2007 1:00 AM:
So this is where all the trolls live. I knew you guys were hiding
somewhere.
Nothing quite like being called a troll by an incompetent moron.

<snip>
@Randy Webb - See above comment. I'm thinking the server was passing a
stone just all you guys were visiting.
That is possible, the error is not there now.
In the past we discussed your "last april" suggestion several times
and at the moment it will return the month on the current day. I'm
50/50 on the issue, so if you feel strongly that it should return the
1st of the month, please post your feedback in the Datejs forums.
No thanks. But, out of curiosity, what date will it give me on the 30th
of this month if I type in "Last February"?
Instead it appears to slaughter all but the last thing it recognizes.

Actually, the parser is doing a damn fine job. You're just entering a
date that does not make sense.
Then the parser should say so instead of spitting out anything. If
nothing else an "Invalid Query" message.
I didn't realize that it was already in such a poor state of
development

Not to pick on you anymore than what's already been done, but you're
just telling people on this list what they want to hear. Can't win
heh?
You don't know me very well, or Lost, for that matter.
// [use case] Schedule a reminder to be sent a week before the start
of the next month at 9 in the morning.
(1).week().before(Date.next().month()).at("9:00 am");

I mean, how awesome is that?
When will it send me a reminder if I schedule it for 2 months from the
30th of this month?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 13 '07 #13

P: n/a
awe. You guys are just jealous.

@David Mark - Enlighten us all, which one of those four libraries
(jQuery, Prototype, Ext, Dojo) is not *ming*-bogglingly incompetent?
Dec 17 '07 #14

P: n/a
On Dec 17, 11:10 am, coolgeoff <ge...@coolite.comwrote:
awe. You guys are just jealous.
No, just confused.
I enter "Next October" and today (Dec 17th 2007) it gives me
October 17th 2008. All well and good.
I enter "Next October 1" and we get "October 2nd 2008"
I enter "Next October 2" and we get "October 4th 2008"

This was the first thing I tried. If I can hit a bug that
fast, I'm not going to use your library. I can't trust it.

Mike

Dec 17 '07 #15

P: n/a
On Dec 17, 6:10 am, coolgeoff <ge...@coolite.comwrote:
awe. You guys are just jealous.
You are right. I always wanted to write an incompetent date library
and support it with an even more incompetent Website. I envy the
public ridicule that has been heaped on your effort so far. Oh to be
you.
@David Mark - Enlighten us all, which one of those four libraries
(jQuery, Prototype, Ext, Dojo) is not *ming*-bogglingly incompetent?
Reduced to pointing out typos? Get your own enlightenment.
Dec 17 '07 #16

P: n/a
coolgeoff said the following on 12/17/2007 6:10 AM:
awe. You guys are just jealous.
You are too incompetent to know if someone was jealous or not. And you
are too ignorant to accept valid criticism.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 17 '07 #17

P: n/a
Come on David, lets here it. Which one of those four libraries gets
the official David Mark stamp of approval?

@chthonic - The bug you found has been fixed. "Next October 1" seems
to work fine now. I appreciate you taking the time to point out the
bug and for making the library better.

@Rozzy - http://www.penny-arcade.com/docs/internetdickwad.jpg

@Randy Webb - Yes, I already know I'm an incompetent looser. Nothing
new there.

Dec 18 '07 #18

P: n/a
On Dec 17, 6:57 pm, coolgeoff <ge...@coolite.comwrote:
Come on David, lets here it. Which one of those four libraries gets
the official David Mark stamp of approval?
If you read carefully, you will see that I didn't imply that any of
them was competent. In fact, it is highly unlikely that the one I
haven't looked at is any better than the three I have.
>
@chthonic - The bug you found has been fixed. "Next October 1" seems
to work fine now. I appreciate you taking the time to point out the
bug and for making the library better.
This isn't a blog you know.

[snip]
Dec 18 '07 #19

P: n/a
@Rob - Date.next and .before were added after the Alpha-1 release. All
the new bits are in SVN (http://www.datejs.com/svn/) and will be
included in the Beta-1 release. Future reference for others, all the
raw code is available in Debug (non-minified) version within the /
trunk/src/ folder. Look for the files with "-debug" tacked onto the
file name.
Dec 18 '07 #20

P: n/a
On Dec 17, 6:57 pm, coolgeoff <ge...@coolite.comwrote:
Come on David, lets here it. Which one of those four libraries gets
the official David Mark stamp of approval?

@chthonic - The bug you found has been fixed. "Next October 1" seems
to work fine now. I appreciate you taking the time to point out the
bug and for making the library better.

@Rozzy -http://www.penny-arcade.com/docs/internetdickwad.jpg

@Randy Webb - Yes, I already know I'm an incompetent looser. Nothing
new there.
I just wish I could wipe my ass with Datejs, I would use it then
Dec 18 '07 #21

P: n/a
@Rozzy - You don't have a printer?
Dec 18 '07 #22

P: n/a
On Dec 18, 11:32 am, coolgeoff <ge...@coolite.comwrote:
@Rozzy - You don't have a printer?
Whoa... That just gave me an idea... I can print out the source code
and wipe my ass with it. Thanks a lot, you made my dream a reality :D.
Dec 18 '07 #23

P: n/a
In comp.lang.javascript message <be0115fe-4ee9-45e3-83c2-6c74361659e5@s1
2g2000prg.googlegroups.com>, Mon, 17 Dec 2007 18:33:42, RobG
<rg***@iinet.net.auposted:
>On Dec 13, 4:00 pm, coolgeoff <ge...@coolite.comwrote:
>The Parser is extremely extensible, so adding support for "Ramadan" or

You can't predict the start of Ramadan to better than 2 or 3 days
accuracy as it is based on sighting the new moon. While a scientific
prediction of that event can be accurate, various countries that
observe it officially do not agree on when it happens.
Some authorities predict it for a year or so in advance; I have to hand
for example a Saudi Airlines calendar covering Dec 2002 to Jan 2004
inclusive (the picture caption for July 2003 mentions Tim B-L & the
WWW!) but with Muslin months including Ramadan.

AIUI, their months are always 29 or 30 days; if the Moon cannot be seen
on the 29th, the Month ends on the following day, unconditionally. So
the closer one gets to Ramadan the more nearly it can be predicted.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6.
Web <URL:http://www.merlyn.demon.co.uk/- w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/- see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Dec 18 '07 #24

P: n/a
On Dec 19, 5:56 am, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
In comp.lang.javascript message <be0115fe-4ee9-45e3-83c2-6c74361659e5@s1
2g2000prg.googlegroups.com>, Mon, 17 Dec 2007 18:33:42, RobG
<rg...@iinet.net.auposted:
On Dec 13, 4:00 pm, coolgeoff <ge...@coolite.comwrote:
The Parser is extremely extensible, so adding support for "Ramadan" or
You can't predict the start of Ramadan to better than 2 or 3 days
accuracy as it is based on sighting the new moon. While a scientific
prediction of that event can be accurate, various countries that
observe it officially do not agree on when it happens.

Some authorities predict it for a year or so in advance; I have to hand
for example a Saudi Airlines calendar covering Dec 2002 to Jan 2004
inclusive (the picture caption for July 2003 mentions Tim B-L & the
WWW!) but with Muslin months including Ramadan.
Yes, it is possible to predict with reasonable certainty when the new
moon will observed from a particular place on earth, however there is
quite a bit of national and religious rivalry - some countries will
start it up to 3 days before another[1].

The discrepancy usually occurs because the new moon is reported as
being sighted early rather than late, but not always.

AIUI, their months are always 29 or 30 days; if the Moon cannot be seen
on the 29th, the Month ends on the following day, unconditionally. So
the closer one gets to Ramadan the more nearly it can be predicted.
That fits with my experience in Saudi Arabia (I haven't lived in any
other Islamic country). The entry in Wikipedia regarding the Umm al-
Qura calendar seems thorough:

<URL: http://www.phys.uu.nl/~vgent/islam/ummalqura.htm >

1. Gulf News: Ramadan 'was announced on wrong day':
<URL: http://archive.gulfnews.com/articles.../10072189.html >

--
Rob
Dec 19 '07 #25

P: n/a
coolgeoff wrote:
Come on David, lets here it. Which one of those four libraries gets
the official David Mark stamp of approval?

@chthonic - The bug you found has been fixed. "Next October 1" seems
to work fine now. I appreciate you taking the time to point out the
bug and for making the library better.

@Rozzy -http://www.penny-arcade.com/docs/internetdickwad.jpg

@Randy Webb - Yes, I already know I'm an incompetent looser. Nothing
new there.
But you should be grateful to these people. They are giving you very
valuable technical advice. It might be a bit harsh indeed; but if you
want an ego-wrapper you'll have to pay for a bunch of beta-testers.

Take their advice seriously and your library can (and will!) become
much better. And if some parts need a new design or be programmed from
scratch, then so be it, but Datejs will benefit vastly from it.

As far as I can see, Datejs looks like a nicely wrapped package which
does the job in most cases. But from what I've read in this thread, it
lacks technical accuracy under more exceptional conditions.

You will probably be interested in
http://www.merlyn.demon.co.uk/js-dates.htm
which is an authority in this regard, though it is unfortunately not
very accessible.

Success!

--
Bart
Dec 19 '07 #26

P: n/a
cruiserdan wrote:
For the record, DateJS has been downloaded over 30,000 times since its
Alpha release and has generally received rave reviews, esp.
Let's eat shit -- a million flies cannot be wrong.
PointedEars
--
"Use any version of Microsoft Frontpage to create your site. (This won't
prevent people from viewing your source, but no one will want to steal it.)"
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Dec 19 '07 #27

P: n/a
Just to continue to correct all the misinformation being put out on
this thread ...
"Cool-a-mundo" until I asked what "Last February" gives if the Date is
December 31. Her reply was "The wrong answer".
'Last February' yields "February 19, 2007".
Type in "Yada" in the box. IE7 outputs "Arg...".
You can output whatever you want. The messages are tongue-in-cheek,
intended for people with a sense of humor.
It would be a lot easier to submit "bugs" if there were anything evident
on the first page to indicate a way to do so.
There are 3 links on the home page to the Google Code page which has
the bug reporting and forums.

---

Dan
Dec 19 '07 #28

P: n/a
In comp.lang.javascript message <14a707d2-89c7-4825-b902-95d3e5cc44fa@e1
0g2000prf.googlegroups.com>, Tue, 18 Dec 2007 17:28:01, cruiserdan
<da*@zeraweb.composted:
>For the record, DateJS has been downloaded over 30,000 times since its
...
>On Dec 18, 11:56 am, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
>In comp.lang.javascript message <be0115fe-4ee9-45e3-83c2-6c74361659e5@s1
...
Since you have chosen to ignore the newsgroup FAQ and accepted Usenet
standards by top-posting and over-quoting in a follow-up to an article
of mint to which you have not referred -- I looked at your
<http://dev.zeraweb.com/homewhich links to <http://code.google.com/p/d
atejs/>.

I see no mention there of :

ISO 8601
The Julian Calendar
The Date of Easter (Gregorian or Julian)
Summer Time
Non-"Christian" dates (with a name like yours ... !)
Year range
To avoid looking silly in IE6 & maybe others, you should try an &nbsp;
in the "Character" box for space.

Your Date.today().addMonths(-2) // Subtract 2 years.
is somewhat surprising. So is
your Date.today().addMilliseconds(200) // Add 500 milliseconds.

Your Date.today().getWeekOfYear() // 43. <static>
requires a statement of the week numbering scheme chosen. Since there
is nothing AFAICS to return the corresponding year number, it's probably
useless in most countries. Otherwise, it'll not be what the USA wants.

Your Date.today().isLeapYear() // true|false
is illiterate. A date cannot be a year. Should be, say, .isInLeapYear
(or isFebruary29th).

Your (1).day().fromNow() // One (1) day from now.
suggests that you have added non-general methods to the Number object.
That, to me, seems inappropriate.

I see nothing to get the number of the day of the week.

You have
Date.oct().forth().sun() // Returns the forth Sunday in October.

I see no mention of Ordinal Date.

I see no mention of, sometimes used on the Continent, roman numerals for
month.

I see no mention of date validation.

I see no mention of finding the last, last-but-one, etc., XXX-day of the
current month.

You have
Format Description
s The seconds of the minute between 1-59.
which seems rather inadequate - only a Heinz of possibilities.

You have
yy Displays the year as a maximum two-digit number. "99" or "07"
Why maximum?

ISTM arrogant to call the file date.js - it is a name which is too
likely to be used elsewhere. Use a name which is long enough to be
probably unique.

I see no mention of which browsers and other engines (e.g. WSH) you have
tested it on. As regular readers here will know, FireFox and Opera have
errors in their date stuff.

You appear to have expanded Date.parse() in a manner which will prevent
it being used in the manner that readers of ISO 16262 will expect, which
is inconsiderate. Call it, for example, Date.Parse or Date.construe.

You have a defective, or at least did not use, a correct SigSep.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6.
Web <URL:http://www.merlyn.demon.co.uk/- w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/- see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Dec 19 '07 #29

P: n/a
On Dec 19, 3:56 pm, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
In comp.lang.javascript message <14a707d2-89c7-4825-b902-95d3e5cc44fa@e1
0g2000prf.googlegroups.com>, Tue, 18 Dec 2007 17:28:01, cruiserdan
<d...@zeraweb.composted:
For the record, DateJS has been downloaded over 30,000 times since its
...
On Dec 18, 11:56 am, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
In comp.lang.javascript message <be0115fe-4ee9-45e3-83c2-6c74361659e5@s1
...

Since you have chosen to ignore the newsgroup FAQ and accepted Usenet
standards by top-posting and over-quoting in a follow-up to an article
of mint to which you have not referred -- I looked at your
<http://dev.zeraweb.com/homewhich links to
I looked at it too. What a pretentious waste. Uses jQuery to do one
lousy fade effect. The CSS hover effects make the text jump. No
doctype, XHTML tags, etc. And this guy aspires to *train* Web
developers? Here's hoping nobody takes him up on it.
Dec 20 '07 #30

P: n/a
On Dec 12, 10:00 pm, coolgeoff <ge...@coolite.comwrote:
So this is where all the trolls live. I knew you guys were hiding
somewhere.
None of the participants in this thread are trolls and it looks like
some valuable criticism has been presented. Unfortunately not all the
participants haven't been able to discuss what is merely a piece of
code civilly. This is the rudest interchange I can remember reading in
two years of reading the group. The comp.lang.javascript newsgroup
contributors know much about browser scripting so take what you can
and let the other antisocial behavior slide by.

[snip]
Did any of you see the API?

// [use case] Schedule a reminder to be sent a week before the start
of the next month at 9 in the morning.
(1).week().before(Date.next().month()).at("9:00 am");

I mean, how awesome is that?
That looks quite complex to me. If a sugary API is the goal, a full
blown interpreter interface would be much simpler. I'd rather write
something like

getDate('one week before next month at 9 am');

Peter
Dec 20 '07 #31

P: n/a

Peter, thank you for your comments. Your post (and good long nap) made
me reflect on the posts in this thread, specifically my comments.

I would like to apologize to the group for some of the comments I made
earlier. They were unprofessional. I would also like to thank all the
participants who took the time to leave constructive criticism. The
feedback is appreciated and the library is stronger for it. Thanks!
Dec 20 '07 #32

P: n/a
@Randy Webb - Let me further explain the "last april" scenario.
<quote>
In the past we discussed your "last april" suggestion several times
and at the moment it will return the month on the current day.
</quote>
At the point I made that statement, the discussion was relative to
December 5th. In retrospect I should have clarified the logic further,
so here goes...

The library will return the month on the current day of this date
instance, unless the current day is out of range in the month the date
is moving to. If the day is out of range, then the last day of the
month will be returned. This logic is mirrored in both the Parser the
API.

Example

var d1 = Date.today(); // 20-Dec-2007
console.log(d1.last().april()); // 20-Apr-2007
// If today is 20-Dec-2007
console.log(Date.parse("last april")); // 20-Apr-2007

var d2 = new Date(2007, 11, 31); // 31-Dec-2007
console.log(d2.last().april()); // 30-Apr-2007
// If today is 31-Dec-2007
console.log(Date.parse("last april")); // 30-Apr-2007

var d3 = new Date(2007, 11, 31); // 31-Dec-2007
console.log(d3.last().february()); // 28-Feb-2007
// If today is 31-Dec-2007
console.log(Date.parse("last february")); // 28-Feb-2007

Using "last year" follows the same principle...

var d4 = new Date(2008, 1, 29); // 29-Feb-2008 (leap year)
console.log(d4.last().year()); // 28-Feb-2007
// If today is 29-Feb-2008
console.log(Date.parse("last year")); // 28-Feb-2007

The following demonstrates using "next month"...

var d5 = new Date(2007, 0, 31); // 31-Jan-2007
console.log(d5.addMonths(1)); // 28-Feb-2007
// or using the sugarpak
console.log(d5.add(1).month()); // 28-Feb-2007
// If today is 31-Jan-2007
console.log(Date.parse("next month")); // 28-Feb-2007

My problem (and maybe yours?) is that I'm not sure "last april" should
return that month on the current day, or just return the 1st of the
month. Like I said earlier, I'm 50/50 on the decision. Any feedback
you (or others) can provide would be appreciated.

I feel "next/last year" should work as it does now. "next/last month"
also seems fine as is. It's just the "last/next [month name]" case
which is questionable.
Dec 20 '07 #33

P: n/a
coolgeoff said the following on 12/20/2007 4:49 AM:
@Randy Webb - Let me further explain the "last april" scenario.
><quote>
In the past we discussed your "last april" suggestion several times
and at the moment it will return the month on the current day.
</quote>

At the point I made that statement, the discussion was relative to
December 5th. In retrospect I should have clarified the logic further,
so here goes...

The library will return the month on the current day of this date
instance, unless the current day is out of range in the month the date
is moving to. If the day is out of range, then the last day of the
month will be returned. This logic is mirrored in both the Parser the
API.
I figured that out :) In my initial post I even said I knew what it was
doing and why it was doing it. Just seems inconsistent is all. If you
are going to return the current day in that month, and it is out of
range, then the user should know that. Meaning, if you want the 31st of
February then the user should be told "That day didn't exist" or, be
given the March 3 on December 31.

<snip>
My problem (and maybe yours?) is that I'm not sure "last april" should
return that month on the current day, or just return the 1st of the
month. Like I said earlier, I'm 50/50 on the decision. Any feedback
you (or others) can provide would be appreciated.
It just seems inconsistent with what it is returning. It should either
return the beginning - across the board - or return current across the
board. If it is going to give the 1st of the month, then give beginning
of the day time. If it is going to give the current day in that month,
then give the current time.
I feel "next/last year" should work as it does now. "next/last month"
also seems fine as is. It's just the "last/next [month name]" case
which is questionable.
What would be nice is "XXX days ago" or "XXX days from now". What was
the date 45 days ago? What will the date be 90 days from now? Or, how
many days since a date. All of those are simple with a Date object but
you should be able to do it within a date library for sure.

And please remember, I am not looking at the code itself, I doubt I
would ever use the library. I am looking at it as things that I do often
enough that it should be in a library. I haven't even looked at the code
behind it.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 20 '07 #34

P: n/a
In comp.lang.javascript message <d86e9f7a-0e4c-4e7e-b4b3-db8949153909@d2
7g2000prf.googlegroups.com>, Thu, 20 Dec 2007 01:49:16, coolgeoff
<ge***@coolite.composted:
>
My problem (and maybe yours?) is that I'm not sure "last april" should
return that month on the current day, or just return the 1st of the
month. Like I said earlier, I'm 50/50 on the decision. Any feedback
you (or others) can provide would be appreciated.
Both are necessary; the programmer needs to choose. In fact he should
be FORCED to choose, by providing one method with a Boolean argument
rather than a pair of methods.

The same should be provided for stepping year instead of month.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6.
Web <URL:http://www.merlyn.demon.co.uk/- w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/- see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Dec 20 '07 #35

This discussion thread is closed

Replies have been disabled for this discussion.