Open DanieleRosada opened 1 year ago
Can you restructure this as a complete example that runs (but, presumably, generates an error)? Specifically, in "this is my test", you don't specify a value for condition
.
Thank you for the fast answer. Snippet code here: https://stackblitz.com/edit/typescript-cro98o?file=index.ts,package.json
I spent a few minutes trying to mimic the moment API using the moment constructor, but gave up and created this working one-shot wrapper.
const momentFormatWrapper = (dateInput: string, format: string) => {
return moment(dateInput).format(format);
};
interpreter.setProperty(globalObject, 'momentFormat', interpreter.createNativeFunction(momentFormatWrapper));
You may then use within the interpreter e.g. momentFormat('6 Mar 2017', 'MM/DD/YY');
I'm trying to import momentjs library. When I use moment().format(), the library pass this to next function, but this is the object of JS-Interpreter and not momentjs. This is my test:
Momentjs code generating problem: