extism / js-pdk

Write Extism plugins in JavaScript & TypeScript
42 stars 16 forks source link

feat: Add basic support for Date #52

Closed bhelx closed 4 months ago

bhelx commented 4 months ago

Closes #51

The caveat is that the JS code doesn't know anything about your timezone yet. It would probably be more efficient to pass an epoch timestamp than a string from the rust code. But i'm not sure how to create a number larger than 32 bits from the rust code at the moment.

chrisdickinson commented 4 months ago

(Popping my head in here – you might be able to return a Float value, which gets you into that 53-bits-of-representable-integer space, but agreed with @zshipko that a string will work for now!)