Re: Conversion of ISO Date String to AppleScript Date
Re: Conversion of ISO Date String to AppleScript Date
- Subject: Re: Conversion of ISO Date String to AppleScript Date
- From: has <email@hidden>
- Date: Sun, 05 Mar 2017 22:52:20 +0000
On 05/03/2017 20:55, Stockly, Ed wrote:
FWIW, I typed the conversion in off the top of my head from a dim
memory based on a version I did years ago. I was worried that the
production version in multiple scripts may ht have the same flaw so I
looked at every script I've done and all accounted for the month issue
(actually, issues) that Shane pointed out and also handled T or space
space for the time delimiter. These scripts have been running
flawlessly (some every day) for years and have never missed a date.
(If they had I would have heard about it)
Not that Apple's code doesn't include its own embarrassing share of
bugs, flaws, and limitations, but given the choice between relying on
their ISO8601 parsing code and your (or my) ISO8601 parsing code, it's
not even a contest. (The Date library I wrote just wraps the
corresponding Cocoa APIs, which is why I somewhat trust it to do the
right thing.) Seriously, why invent your own half-baked version of logic
that already exists, has been implemented against the official spec not
some amateur guess, has been massively battle-tested by millions over
two decades, and is provided as standard and totally free? What are you
and the rest of the responders trying to achieve, other than to show off
to others what a clever clogs you are? (A dog-and-pony show that only
impresses the noobs and rubes.)
BTW, it's NOW enough to test your code with valid inputs and claim it is
correct—you must also guarantee it behaves safely and reliably when fed
malformed/out-of-range data as well. Defensive Programming 101. Oh, and
since AppleScript is an absolute horror for global TIDs and system
localizations altering output when working with text, dates, numbers,
and their conversions, you need to test those too. As I pointed out
elsewhere, saying "it works for me" doesn't mean diddly unless you're
saying "it ONLY works for me" as well.
What is awesome about AppleScript is its ability to deliver powerful and
productive application automation and integration solutions with a few
lines of glue code. Amateur scripters endlessly rolling their own crappy
fragile algorithms to perform simple data processing tasks that Computer
Scientists and OS vendors already addressed decades ago and thinking
that's anything except an embarrassing failure of both the AppleScript
platform and its community is not.
If end-user programmers really want to help themselves, first learn the
difference between high-value productivity and low-value scut work. Dog
knows there's millions of "professional" programmers pathological
incapable of making that distinction, so just think of all the circles
you could run around them once you can.
has
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden