import { format } from 'riot-format';
//make it global;
window.format = format;
console.log(format(new Date(), 'date').current);
<app>
{ format(new Date()) }
</app>
Note: this way the format method is available for all tags.
import format from 'riot-format';
import * as riot from 'riot';
format(riot);//mixin it globally
Note: you should mixin it before you import any riot tags. The format method is availalbe for all tags.
//app.js
import { format } from 'riot-format';
riot.mixin('riot-format', {
format
})
<app>
<span>{ format(new Date()) }</span>
this.mixin('riot-format');
</app>
Note: in this case the format method is available in the tag you defined.
import {format} from 'riot-format';
<app>
<span>{ format(new Date()) }</span>
</app>
Note: this way format is supposed to be available in the tag you defined.
Besides these methods, you can define more formatters as you need.