indexer icon indicating copy to clipboard operation
indexer copied to clipboard

Query parameters after-time and before-time for /v2/transactions always assume UTC even if a different timezone is specified

Open fabrice102 opened this issue 4 years ago • 0 comments

Summary

Query parameters after-time and before-time for /v2/transactions always assume UTC even if a different timezone is specified.

$ curl -s "https://testnet.algoexplorerapi.io/idx2/v2/transactions?after-time=2021-04-24T21:30:00-04:00&before-time=2021-04-24T21:30:08-04:00" | jq
{
  "current-round": 13748828,
  "next-token": "9LrRAAAAAAAAAAAA",
  "transactions": [
    {
      "asset-transfer-transaction": {
        "amount": 100000000,
        "asset-id": 12726651,
        "close-amount": 0,
        "receiver": "YM7QN2ORZGARPPMBPMZZMLLJDHSVPZU75HUPMRQUEUU6VQOXADQJ4HUIQM"
      },
      "close-rewards": 0,
      "closing-amount": 0,
      "confirmed-round": 13744884,
      "fee": 1000,
      "first-valid": 13744882,
      "genesis-hash": "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",
      "genesis-id": "testnet-v1.0",
      "id": "LGM5ZPNGECOXVKQOBUVVF7FX4DIAE24ZDAXWOUCP5ORWX5VTQSFA",
      "intra-round-offset": 0,
      "last-valid": 13745882,
      "note": "gqZwVHhuSWTZJDcwNmVlZGVmLWI0OTctNDcwMi1iYzcwLWNjNTdkYzRjZTIzNKR0eXBlpWlzc3Vl",
      "receiver-rewards": 0,
      "round-time": 1619299805,
      "sender": "UPCPV3UZ4GKXERPFSKDZ3ZRJRN3AFKZYXU7CIENQQ6E4KOWEXRUJ7KOHUQ",
      "sender-rewards": 439,
      "signature": {
        "sig": "YsqUETiATb7n/AauJ0zCdZxPn2WVGpGcAYbJgXD35DCCJ5ZNdg5ZbTsvimnxdMRN2HvKTWJYQJZlimBSi+aSBg=="
      },
      "tx-type": "axfer"
    }
  ]
}

where the round timestamp is 1619299805, that is 2021-04-24 17:30:05-04:00.

This is the same result as:

$ curl -s "https://testnet.algoexplorerapi.io/idx2/v2/transactions?after-time=2021-04-24T21:30:00Z&before-time=2021-04-24T21:30:08Z" | jq

Same issue with PureStake API indexer endpoint.

Scope/Requirements

Support for timezone or require explicitly parameters to be in the UTC timezone and fail otherwise.

Urgency

Since you can always convert the time you get, this isn't super urgent. However, this is a bug that we should fix.

fabrice102 avatar Apr 25 '21 02:04 fabrice102