osmosis-labs / osmojs

OsmosJS makes it easy to compose and broadcast Osmosis and Cosmos messages
https://cosmology.zone/products/osmojs
Apache License 2.0
63 stars 33 forks source link

Getting date.getTime is not a function #84

Open shukr-acharya opened 10 months ago

shukr-acharya commented 10 months ago

Getting date.getTime is not a function error from toTimestamp present in helpers.ts On broadcasting '/cosmos.authz.v1beta1.MsgGrant' message On 16.9.0 osmojs version

function toTimestamp(date) {
      const seconds = numberToLong(date.getTime() / 1e3);
      const nanos = date.getTime() % 1e3 * 1e6;
      return {
        seconds,
        nanos
      };
    }
Zetazzz commented 10 months ago

Hi

Is it possible that the expiration field's set to a string while it's type's date?

shukr-acharya commented 10 months ago

we provide expiration time in seconds (number)

Zetazzz commented 10 months ago

we provide expiration time in seconds (number)

I see, please set the expiration field a Date type. I mean, expiration seconds can be transferred to an expiration Date