> if a future version of ActionScript allows users to override operators in custom classes

 

I've heard that the committee designing the next version of Ecmascript is considering this. If they add this language feature, we'll likely follow their lead.

 

- Gordon

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Kelly Birr
Sent: Monday, June 26, 2006 3:06 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re: Difference between two dates

 

Yes, but this still requires knowing if your variable is a date or not. A
straight primitive == would not. To test for that would only be 2 extra
lines of code but it's still a special case that you have to put everywhere.

My point is only that having to treat Dates differently from Numbers and
Strings and use functions for comparison is inconvenient, no matter how
simple it actually may be. This could be improved by making them (or a new
class) a primitive.

Of course if a future version of ActionScript allows users to override
operators in custom classes, I can create my own [primitive-like] Date
class. Then no-one will have to hear me complain. :)

- Kelly

-----Original Message-----
From: [EMAIL PROTECTED]ups.com [mailto:[EMAIL PROTECTED]ups.com] On
Behalf Of Tim Hoff
Sent: Monday, June 26, 2006 2:42 PM
To: [EMAIL PROTECTED]ups.com
Subject: [flexcoders] Re: Difference between two dates

Hi Kelly,

For simple comparisons there is are compare() and dateCompare() functions in
the mx.utils.ObjectUtil class.

-TH

--- In [EMAIL PROTECTED]ups.com, "Kelly Birr" <[EMAIL PROTECTED].> wrote:
>
> Yes thank you, this is helpful. I did already have some routines
built to
> do this but this one is a bit better. Never-the-less I still
believe the
> language would be improved by making a Date primitive.
>
> Just because we have workarounds does not mean we should settle
for them.
> The fact still remains that this requires extra code, especially
if your
> trying to do a comparison between 2 variables whose actual types
you don't
> know (or care) and just want to know if they are equivalent or not.
>
> I understand that it's way too late in the Flex 2.0 game for any
of this,
> but here's hoping for Flex 2.1
>
> - Kelly
>
> _____
>
> From: [EMAIL PROTECTED]ups.com
[mailto:[EMAIL PROTECTED]ups.com] On
> Behalf Of Douglas Knudsen
> Sent: Monday, June 26, 2006 11:56 AM
> To: [EMAIL PROTECTED]ups.com
> Subject: Re: [flexcoders] Difference between two dates
>
>
> http://jeff.mxdj.com/datediff_for_actionscript.htm
>
> perhaps this would be helpful.
>
> DK
>
>
> On 6/26/06, Kelly Birr <[EMAIL PROTECTED].> wrote:
>
> If you do not wish to change the Date class so it will conform to a
> (terrible) standard, I can sort of understand that.
>
> Would you please consider the possibility of adding a DateTime or
Date2
> class in Flex 2.1 that works like a primitive type. Or better
yet, make the
> new class be Date and the standards-compliant one called EcmaDate
or EDate
> or CDate or something like that. :)
>
> - Kelly
>
> _____
>
>
>
> From: [EMAIL PROTECTED]ups.com
[mailto:[EMAIL PROTECTED]ups.com] On
> Behalf Of Daniel Tuppeny
>
> Sent: Monday, June 26, 2006 1:03 AM
> To: [EMAIL PROTECTED]ups.com
>
> Subject: RE: [flexcoders] Difference between two dates
>
>
>
> > Since the Date class is specified by the EcmaScript-262
standard, we're
> not going to change it
>
> That's fair enough, but as things are (without a utility class to
do this
> stuff), I can see there being a whole bunch of "buggy"
implementations of
> date stuff in Flex over the coming months, which will be spread
amongst
> developers via sites like CodeProject!! :-(
>
> _____
>
> From: [EMAIL PROTECTED]ups.com
[mailto:[EMAIL PROTECTED]ups.com] On
> Behalf Of Gordon Smith
> Sent: 24 June 2006 00:01
> To: [EMAIL PROTECTED]ups.com
> Subject: RE: [flexcoders] Difference between two dates
>
>
>
> Since the Date class is specified by the EcmaScript-262 standard,
we're not
> going to change it. But it sounds like we should consider adding a
> flex.utils.DateUtils class in the future to make date manipulation
easier.
>
>
>
> - Gordon
>
>
>
>
> _____
>
>
> From: [EMAIL PROTECTED]ups.com [mailto:
> <mailto:[EMAIL PROTECTED]ups.com> [EMAIL PROTECTED]ups.com] On
Behalf Of
> Pan Troglodytes
> Sent: Friday, June 23, 2006 8:53 AM
> To: [EMAIL PROTECTED]ups.com
> Subject: Re: [flexcoders] Difference between two dates
>
>
>
> Well, it helped when I figured out I could do things like
date.date += 12
> and it would automatically correct for rolling over months/years.
But at
> the very least, there needs to be a built-in daysBetween
function. Yes,
> yes, I know you can do the getTime() arithmetic. But every time
you have to
> fall back to that, it feels kludgy.
>
> If I were redesigning it, it wold at least ook like this:
>
> dayOfWeek - what used to be called day day - day in month (used to be
> called date) month - 1 based like day (what used to be called date) is
> hour/minute/second/millisecond - singular (if hour is plural, why
not
> "months"?)
> year - why fullYear? I mean, c'mon, do people really expect
something
> called "year" to be two digits or what?
> daysBetween(laterDate:date) - laterDate minus this in days
>
> But, alas, it's too late. There's no way they'll make the change
at this
> late day.
>
> I mean "date".
>
> Haha.
>
> On 6/23/06, Daniel Tuppeny < <mailto:d.tuppeny@...> [EMAIL PROTECTED].>
> wrote:
>
> I wouldn't disagree!
>
>
>
> There seems to be no useful functions for manipulating dates. They
should
> copy all the methods and properties from the .NET DateTime
class :o)
>
>
>
>
> _____
>
>
> From: [EMAIL PROTECTED]ups.com
[mailto:[EMAIL PROTECTED]ups.com] On
> Behalf Of Pan Troglodytes
> Sent: 23 June 2006 16:02
> To: [EMAIL PROTECTED]ups.com
> Subject: Re: [flexcoders] Difference between two dates
>
> I swear, I really think the date class was designed by a crazy
man. You
> hear that Adobe? - CRAZY! :D
>
> On 6/23/06, Daniel Tuppeny < <mailto:d.tuppeny@...> [EMAIL PROTECTED].>
> wrote:
>
> I was using .day instead of .date
>
>
>
> TFI Friday! =)
>
>
>
>
> _____
>
>
> From: [EMAIL PROTECTED]ups.com [mailto:
> <mailto:[EMAIL PROTECTED]ups.com> [EMAIL PROTECTED]ups.com] On
Behalf Of
> Daniel Tuppeny
> Sent: 23 June 2006 15:33
> To: [EMAIL PROTECTED]ups.com
> Subject: RE: [flexcoders] Difference between two dates
>
> I think I need more coffee....
>
>
>
> The following code (which I'm sure is correct!), returns around
2.8 when I'm
> expecting around 3.2. Anyone spot my error?
>
>
>
>
>
>
>
> public static function getMonths(startDate:Date,
endDate:Date):Number
> {
> if (startDate > endDate)
> {
> var tmp:Date = endDate;
> endDate = startDate;
> startDate = tmp;
> }
>
> var numMonths:Number = 0;
>
> // Get number of months in years
> numMonths += (endDate.fullYear - startDate.fullYear) * 12
> numMonths += endDate.month - startDate.month;
> numMonths += (endDate.day - startDate.day) / 30; // This needs
fixing
>
> return numMonths;
> }
>
>
>
__________________________________________________________
_
> This email has been scanned by the MessageLabs Email Security
System.
> For more information please visit http://www.messagelabs.com/email
>
__________________________________________________________
_
>
>
>
> [Inbound Mail Scanned by MessageLabs]
>
>
>
>
__________________________________________________________
_
> This email has been scanned by the MessageLabs Email Security
System.
> For more information please visit http://www.messagelabs.com/email
>
__________________________________________________________
_
>
>
>
>
>
>
>
> --
> Jason
>
>
> [Inbound Mail Scanned by MessageLabs]
>
>
__________________________________________________________
_
> This email has been scanned by the MessageLabs Email Security
System.
> For more information please visit http://www.messagelabs.com/email
>
__________________________________________________________
_
>
>
>
>
> --
> Jason
>
>
>
>
> [Inbound Mail Scanned by MessageLabs]
>
>
>
__________________________________________________________
_
> This email has been scanned by the MessageLabs Email Security
System.
> For more information please visit http://www.messagelabs.com/email
>
__________________________________________________________
_
>
>
>
>
>
> --
> Douglas Knudsen
> http://www.cubicleman.com
> this is my signature, like it?
>

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to