1.5 KiB
Vendored
Day.js
Day.js is a date manipulation library that's used by Trilium, but it's also shared with both front-end and back-end scripts. For more information about the library itself, consult the official documentation.
How to use
The dayjs method is provided directly in the api global:
const date = api.dayjs();
api.log(date.format("YYYY-MM-DD"));
Plugins
Day.js uses a modular, plugin-based architecture. Generally these plugins must be imported, but this process doesn't work inside Trilium scripts due to the use of a bundler.
Since v0.100.0, the same set of plugins is available for both front-end and back-end scripts.
The following Day.js plugins are directly integrated into Trilium:
- AdvancedFormat
- Duration, since v0.100.0.
- IsBetween
- IsoWeek
- IsSameOrAfter
- IsSameOrBefore
- QuarterOfYear
- UTC
Note
If another Day.js plugin might be needed for scripting purposes, feel free to open a feature request for it. Depending on the size of the plugin and the potential use of it inside the Trilium code base, it has a chance of being integrated.