Skip to content

Commit

Permalink
Energinet: fix timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Nov 20, 2023
1 parent 5e6f861 commit 22859ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tariff/energinet.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func (t *Energinet) run(done chan error) {

ts := time.Now().Truncate(time.Hour)
uri := fmt.Sprintf(energinet.URI,
ts.Format(time.RFC3339),
ts.Add(24*time.Hour).Format(time.RFC3339),
ts.Format(energinet.TimeFormat),
ts.Add(24*time.Hour).Format(energinet.TimeFormat),
t.region)

if err := backoff.Retry(func() error {
Expand Down
5 changes: 4 additions & 1 deletion tariff/energinet/types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package energinet

const URI = "https://api.energidataservice.dk/dataset/Elspotprices?offset=0&start=%s&end=%s&filter={\"PriceArea\":[\"%s\"]}&timezone=dk&limit=48"
const (
URI = "https://api.energidataservice.dk/dataset/Elspotprices?offset=0&start=%s&end=%s&filter={\"PriceArea\":[\"%s\"]}&timezone=dk&limit=48"
TimeFormat = "2006-01-02T15:04" // RFC3339 short
)

type Prices struct {
Records []PriceInfo `json:"records"`
Expand Down

0 comments on commit 22859ab

Please sign in to comment.