monosux/ethereum-block-by-date

Can you please add support for timestamps?

Closed this issue · 1 comments

I would like to get the block number by inputting a timestamp. Could you please add this functionality? THX!

Hi @dewindtk,

You can just multiply timestamp by 1000 and use it:

const my_timestamp = 1663224162;
const block = await dater.getDate(my_timestamp * 1000);
console.log('block', block);