greenbutton icon indicating copy to clipboard operation
greenbutton copied to clipboard

Date parsing strangely

Open amassaad opened this issue 11 years ago • 1 comments

Hi there, I really love the gem, but can only get it to work with the example xml . . .

I'm using a GreenData xml file from Hydro Ottawa, it looks quite similar to the example.

I've debugged the parsing to the point where the code to compare date is not working, its showing my usage block.start_date with many extra numbers in the place of year - no idea why!

Any ideas? I'm probably going to to hack around it a bit more to filter the month/date only perhaps . . .

Example of block.start_date

4433002275187731438746019881772482893785622661656341187475905148999181352977816152827687545361460765095368145865287217857415233258712704573033546661925398285614339527847981021284949828082256296665913786624411639630884504118400788561610893223784700119771097284725126913402160162997174548416507444140997525707806445183679380748863202636832607091411870240254534092525878925633284735528393236461500738094541694901377118398511372535598939540168562626656723383186057196807600474309990398955716636195774040579180042487637345964655715038683187653869117595387984133828938984829718040708114460461200479818659297019879486904878265854201432386132729168965509216523970147691718196358572496355205813032898122982220020794403762602015560327681837398372314328877846001747560411222694511225468467301295942650420022313986655897570227679783968363484578804949227688955511738351916921708636503951438656498422281131796454871201416411004072638687-06-24 04:00:00 UTC

amassaad avatar Sep 14 '14 21:09 amassaad

Thanks for checking it out Alex.

So I imagine you are getting this for interval_block.start_time? I think there may be a problem with the interval start time xpath (class IntervalBlock https://github.com/cew821/greenbutton/blob/master/lib/greenbutton/gb_classes.rb) and/or the data type casting ( https://github.com/cew821/greenbutton/blob/master/lib/greenbutton/helpers.rb). Its probably trying to parse a Unix time and getting a weird string... My guess without seeing the file.

Let me know how it goes and if you want to push a patch.

Eric On Sep 14, 2014 2:13 PM, "Alex Massaad" [email protected] wrote:

Hi there, I really love the gem, but can only get it to work with the example xml . . .

I'm using a GreenData xml file from Hydro Ottawa, it looks quite similar to the example.

I've debugged the parsing to the point where the code to compare date is not working, its showing my usage block.start_date with many extra numbers in the place of year - no idea why!

Any ideas? I'm probably going to to hack around it a bit more to filter the month/date only perhaps . . .

Example of block.start_date

4433002275187731438746019881772482893785622661656341187475905148999181352977816152827687545361460765095368145865287217857415233258712704573033546661925398285614339527847981021284949828082256296665913786624411639630884504118400788561610893223784700119771097284725126913402160162997174548416507444140997525707806445183679380748863202636832607091411870240254534092525878925633284735528393236461500738094541694901377118398511372535598939540168562626656723383186057196807600474309990398955716636195774040579180042487637345964655715038683187653869117595387984133828938984829718040708114460461200479818659297019879486904878265854201432386132729168965509216523970147691718196358572496355205813032898122982220020794403762602015560327681837398372314328877846001747560411222694511225468467301295942650420022313986655897570227679783968363484578804949227688955511738351916921708636503951438656498422281131796454871201416411004072638687-06-24 04:00:00 UTC

— Reply to this email directly or view it on GitHub https://github.com/cew821/greenbutton/issues/5.

erichulburd avatar Sep 15 '14 04:09 erichulburd