I am using the below code to create a new filter in twig
const twig = require("twig");
twig.extendFilter("date_format", (value) => {
return value ? dateFNS.format(value.unixUTC, "MM/dd/yyyy") : null;
});
Similarly, how can we create a new filter in twing
?
I have tried with below method
const { TwingFilter, TwingEnvironment, TwingLoaderFilesystem } = require("twing");
const format_date = new TwingFilter("format_date", (value) => {
return value ? dateFNS.format(value.unixUTC, "MM/dd/yyyy") : null;
});
const loader = new TwingLoaderFilesystem([
"./screen"
]);
const twing = new TwingEnvironment(loader);
twing.addFilter(format_date);
But it is giving below error
TypeError: callable.apply(...).catch is not a function