Green-Software-Foundation/carbon-aware-sdk

[Bug]: Different times will return data with different structures.

Closed this issue · 6 comments

Contact Details

JasonLuuk@outlook.com

What happened?

A bug happened!
If you search for emission data for a partial date, e.g. =2021-04-27&toTime=2021-04-28", the returned data starts at 23:00 of the previous day that first day, and ends at 22:00 of the last day.
image

If you search for emission data for during these days, e.g. =2021-03-27&toTime=2021-03-28", the returned data starts at 0:00 of the first day, and ends at 23:00 of the last day.
image

The data source I use is electronic maps.

client

WebAPI (Default)

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Hi @JasonLuuk is it possible to have a bit more information here please? I looks like you are experiencing a 1 hour shift which may be timezone related?
Where are you based please? You might need to specify the time in your request (taking into account your timezone)

Sorry, I didn't realise about it maybe related to the time zone, I'm base in UK right not, GMT time, could you tell me how to add the time zone to the query statement if possible? @danuw

No worries.

You will need to convert to UTC format and pass in like that 2022-03-01T00:00:00Z to 2022-03-01T23:59:00Z ( I usually use that delta)

Can you try and let us know? (what client are you using please?)

@danuw thankyou very much, I'm using webapi and if I use your method, the data will be returned correctly from 0:00 of the day. So is there no way to continue the query without writing T00:00:00Z?

Hi no currently this is how this is implemented. If that is how you need it, you could keep that time part hardcoded and only provide the date part ? (keeping the difference to match whatever timezone you are targetting)

Will close this issue, but feel free to carry on asking question or opening a discussion on how to update and why...

Thank you