[SOLVED] api/v2/dateToBlock Goerli http 500 when requesting a block with date before first block

Hello everyone.

There seems to be a bug if you try use the date that’s before the first Block.
Timestamp that works:

Timestamp that cause a 500 error:

and all less than that.

Hi @robk99, :grinning:

It makes sense that the response would be a 500 internal server error if you try to specify a date that is before the first block, since there are no blocks at that point in time.

You can handle this error on your end by taking the appropriate action sin your app if you receive an error response.

Let us know if this answers your question or if we can help with something else.

Thanks for the response.

The thing that confused me is that on ETH chain
everything works fine with date: 1
URL: https://docs.moralis.io/web3-data-api/evm/reference/get-date-to-block?chain=eth&date=1
and that you returned error 500 so I thought it was an error on Goerli.

If returning error 500 is ok with your practices, then no problem you can close the issue
and I’ll handle the case in my app.

1 Like