[flexcoders] Re: datefield issue

2009-03-16 Thread Greg Morphis
I feel like I hacked it but I added a .sethours(12,0,0,0)
at the top of the code before it saves dispatches the event..
Is there a less hacky-feeling fix for this? this works fine but leaves
a bad taste in my mouth

On Mon, Mar 16, 2009 at 2:51 PM, Greg Morphis  wrote:
> out of the pan and into the fire
>
> I have a datefield and I choose for example April 1, the date saves as 3/31.
> If I choose 3/31, it saves 3/30..
> Is this a timezone issue with Flex? is this easy to fix?
> When I Alert the value I see
> Tue Mar 31 00:00:00 GMT -0500 2009 (when I choose March 31st)
> So why isnt it staying on March 31st?
>
> Thanks!
>


[flexcoders] Re: datefield issue

2009-03-17 Thread max.nachlinger
--- In flexcoders@yahoogroups.com, Greg Morphis  wrote:
>
> out of the pan and into the fire
> 
> I have a datefield and I choose for example April 1, the date saves as 3/31.

Greg,

Flex / Flash actually remotes dates without consideration of their Timezone 
offsets (so 4/1/2009 00:00 sent from a SWF in GMT-0500 remotes as 3/31/2009 
22:00 when sent to a server in GMT-0700).  This Flex cookbook entry summarizes 
the problem and provides one possible solution: 
http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&productId=2&postId=12168

Another solution would be to ditch the Date type altogether for mid-tier 
transmission and send dates as strings.  We implemented this approach on my 
team with minimal suffering :)  You'll obviously have to parse the string when 
sending or receiving, but if the date is in a perdictable string-format, it 
will work fine.  On the Flex side, use a DateFormatter for sending and 
transform the received date-strings into dates via new 
Date(Date.parse(someServerDateString)).



Re: [flexcoders] Re: datefield issue

2009-03-16 Thread Beau Scott
Months are 0-based in ecmascript (JS, AS, etc.) Date objects. 0 = jan., 1 =
feb., etc.
http://livedocs.adobe.com/flex/3/langref/Date.html#month

Use a date formatter if you need to format this to a string and don't want
to manually convert the month offset. (probably a good idea to use the date
formatter anyway when you're dealing with locales.)






On Mon, Mar 16, 2009 at 2:01 PM, Greg Morphis  wrote:

>   I feel like I hacked it but I added a .sethours(12,0,0,0)
> at the top of the code before it saves dispatches the event..
> Is there a less hacky-feeling fix for this? this works fine but leaves
> a bad taste in my mouth
>
>
> On Mon, Mar 16, 2009 at 2:51 PM, Greg Morphis 
> >
> wrote:
> > out of the pan and into the fire
> >
> > I have a datefield and I choose for example April 1, the date saves as
> 3/31.
> > If I choose 3/31, it saves 3/30..
> > Is this a timezone issue with Flex? is this easy to fix?
> > When I Alert the value I see
> > Tue Mar 31 00:00:00 GMT -0500 2009 (when I choose March 31st)
> > So why isnt it staying on March 31st?
> >
> > Thanks!
> >
>  
>



-- 
Beau D. Scott
Software Engineer


Re: [flexcoders] Re: datefield issue

2009-03-16 Thread Beau Scott
wait, my bad, I misread. disregard my previous remark.



On Mon, Mar 16, 2009 at 2:26 PM, Beau Scott  wrote:

> Months are 0-based in ecmascript (JS, AS, etc.) Date objects. 0 = jan., 1 =
> feb., etc.
> http://livedocs.adobe.com/flex/3/langref/Date.html#month
>
> Use a date formatter if you need to format this to a string and don't want
> to manually convert the month offset. (probably a good idea to use the date
> formatter anyway when you're dealing with locales.)
>
>
>
>
>
>
>
> On Mon, Mar 16, 2009 at 2:01 PM, Greg Morphis  wrote:
>
>>   I feel like I hacked it but I added a .sethours(12,0,0,0)
>> at the top of the code before it saves dispatches the event..
>> Is there a less hacky-feeling fix for this? this works fine but leaves
>> a bad taste in my mouth
>>
>>
>> On Mon, Mar 16, 2009 at 2:51 PM, Greg Morphis 
>> >
>> wrote:
>> > out of the pan and into the fire
>> >
>> > I have a datefield and I choose for example April 1, the date saves as
>> 3/31.
>> > If I choose 3/31, it saves 3/30..
>> > Is this a timezone issue with Flex? is this easy to fix?
>> > When I Alert the value I see
>> > Tue Mar 31 00:00:00 GMT -0500 2009 (when I choose March 31st)
>> > So why isnt it staying on March 31st?
>> >
>> > Thanks!
>> >
>>  
>>
>
>
>
> --
> Beau D. Scott
> Software Engineer
>



-- 
Beau D. Scott
Software Engineer