Get block by date doesn't seem to be working with UNIX timestamp

Hi there,
when I am trying to use the following:

const response = await Moralis.EvmApi.block.getDateToBlock({
    chain: '0x1',
    date: '1685631347',
  });

I get an error:

RangeError: Invalid time value

This runs fine, however, in the documentation interface:
https://docs.moralis.io/web3-data-api/evm/reference/get-date-to-block?chain=eth&date=1685613815

From what I can see from the error it seems like indeed the Moralis SDK uses a format that needs to be fed with datestring: @moralisweb3/common-evm-utils/lib/esm/index.js, line 5736.

Any idea how this can be used with a UNIX timestamp?

Thanks in advance,
Thomas

Hi, thanks for reporting, we will check

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.