PBMCube / as3yaml

Automatically exported from code.google.com/p/as3yaml
0 stars 0 forks source link

Date parsing incorrect #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

The following data:

- data_range: day
  consumption_unit: lt
  temperature_unit: C
  average_range: day
  tank_id: "2"
  temperature: 0.0
  consumption_amount: 0.0
  consumed_at: 2007-10-29T00:00:00+00:00
- data_range: day
  consumption_unit: lt
  temperature_unit: C
  average_range: day
  tank_id: "2"
  temperature: 11.1
  consumption_amount: 0.0
  consumed_at: 2007-11-05T00:00:00+00:00
- data_range: day
  consumption_unit: lt
  temperature_unit: C
  average_range: day
  tank_id: "2"
  temperature: 2.9
  consumption_amount: 24954.0
  consumed_at: 2007-11-12T00:00:00+00:00
- data_range: day
  consumption_unit: lt
  temperature_unit: C
  average_range: day
  tank_id: "2"
  temperature: 11.5
  consumption_amount: 23430.0
  consumed_at: 2007-11-19T00:00:00+00:00
- data_range: day
  consumption_unit: lt
  temperature_unit: C
  average_range: day
  tank_id: "2"
  temperature: 10.1
  consumption_amount: 31368.0
  consumed_at: 2007-11-26T00:00:00+00:00

What is the expected output? What do you see instead?

The first is on October. The rest is on November.

But as3yaml parses everything as October.

What version of the product are you using? On what operating system?
Flex Builder 3 Linux.

Please provide any additional information below.
Works fine on YAML Ruby parser.

Original issue reported on code.google.com by ceefour666@gmail.com on 30 Mar 2008 at 11:01

GoogleCodeExporter commented 9 years ago
Thank you for the bug report.

Unfortunately, I cannot reproduce the error.  When I load this yaml with the
following code

public function onTestIssueFive(event : Event, ldr : URLLoader) : void
{
  var yaml : Array  = YAML.decode(ldr.data) as Array;

  for each(var obj: Object in yaml)
  {
    var dte: Date = obj.consumed_at as Date;
    trace(dte.toDateString())
  }
}

I get the following output:

Mon Oct 29 2007
Mon Nov 5 2007
Mon Nov 12 2007
Mon Nov 19 2007

I am running this on Windows, so I'll check to see if I can reproduce the error 
on
Linux (though I really hope that this is not the problem).

Original comment by dwischu...@gmail.com on 31 Mar 2008 at 12:12

GoogleCodeExporter commented 9 years ago
Thank you for the prompt response.

I'll attempt to make a small Flex builder project that demonstrates this bug 
(if it's
really as3yaml's).

Thanks before.

Original comment by ceefour666@gmail.com on 31 Mar 2008 at 12:32

GoogleCodeExporter commented 9 years ago
here's a very small flex 3 project that demonstrates the bug.

the package is big because i included the compiled SWF files, in case 
something's
wrong with my compiler. so checkout the SWF from bin-debug first before 
recompiling
the app with your own.

Original comment by ceefour666@gmail.com on 31 Mar 2008 at 12:58

Attachments:

GoogleCodeExporter commented 9 years ago
this is that app screenshot in my computer

the _str fields is the input in yaml

other fields are the parsed Date objects, which are incorrect

"should_be" is basically the same as *_str but human readable

note that it also signifies that the timezone didn't get parsed correctly. 
input is
(for *_tz data points) in UTC so if possible, output should also be UTC. if
translated to localtime, then the resulting localtime should have timezone
shift/correction as well.

Original comment by ceefour666@gmail.com on 31 Mar 2008 at 1:01

Attachments:

GoogleCodeExporter commented 9 years ago
Thank you.

I was able to reproduce the bug.  The bug actually appears to be a problem with 
the
setMonth method on the Date class (sometimes it just doesn't do anything).

I've found a solution though.  I'll do some more testing and hopefully post an 
update
tomorrow.

Original comment by dwischu...@gmail.com on 31 Mar 2008 at 4:11

GoogleCodeExporter commented 9 years ago
YESSS! :)

So it's a Flex bug (?)

I was so frustrated with this bug I almost wanted to change "back" into XML..

Also had weird fun while finding this bug. Because I had about 5800 data points 
the
first time and I was wondering why the chart doesn't always draw "right-wards".

Then I changed it to have only fewer data points (several weeks rather than 
days in a
year). Lucky I also set the proper dataUnits so I can see that the chart series 
is
sometimes overlapping with each other. Was very weird feeling since I was sure 
that
the data input is aligned exactly weekly.

So I turned on dataTips and last used a data grid instead of a chart and the 
problem
becomes clear.

Can you describe more about the Date class problem? If it's indeed a Date bug 
then it
probably should be reported to Adobe's bug tracker.

Thanks a lot. I've to say as3yaml is one of the most useful libraries we've came
across in Flex. Tried to use XML, JSON before but YAML seems to be doing the 
best
balance of them. Not to mention that our backend of choice is currently 
Rails/Ruby
(doesn't have to, though) so making YAMLs is quite a snap.

Original comment by ceefour666@gmail.com on 31 Mar 2008 at 8:26

GoogleCodeExporter commented 9 years ago
Ahhh... nevermind, the issue was in my code.

The problem was that the Date object was getting initialized to the current date
(e.g, 3-31-2008) and I was setting the month before I was setting the date.  
So, for
example, when I would try to set the month to February I was trying to set the 
full
date to 2-31-08 which, of course, does not exist.

In any case, the fix is simple enough and I should have a new version posted 
later today.

Original comment by dwischu...@gmail.com on 31 Mar 2008 at 3:38

GoogleCodeExporter commented 9 years ago
You're awesome too here :) Thanks for willing to take matters into details :)

Original comment by ceefour666@gmail.com on 31 Mar 2008 at 4:06

GoogleCodeExporter commented 9 years ago
Attaching the updates to this page because Google is generating an error when I 
try
to to upload the files to the Downloads section.

Original comment by dwischu...@gmail.com on 1 Apr 2008 at 3:19

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by dwischu...@gmail.com on 1 Apr 2008 at 3:20