mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-08-16 08:31:57 +02:00
Link date-fns format docs from timestamp.format (#529)
This commit is contained in:
@@ -50,6 +50,19 @@ const formatArg: TemplateFunctionArg = {
|
||||
type: "text",
|
||||
};
|
||||
|
||||
const formatDocsBanner: TemplateFunctionArg = {
|
||||
type: "banner",
|
||||
color: "info",
|
||||
inputs: [
|
||||
{
|
||||
type: "markdown",
|
||||
content:
|
||||
"Uses [date-fns format tokens](https://date-fns.org/docs/format), " +
|
||||
"not dayjs or Moment. Wrap literal text in single quotes to escape it.",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const plugin: PluginDefinition = {
|
||||
templateFunctions: [
|
||||
{
|
||||
@@ -82,7 +95,7 @@ export const plugin: PluginDefinition = {
|
||||
{
|
||||
name: "timestamp.format",
|
||||
description: "Format a date using a date-fns format string",
|
||||
args: [dateArg, formatArg],
|
||||
args: [formatDocsBanner, dateArg, formatArg],
|
||||
previewArgs: [formatArg.name],
|
||||
onRender: async (_ctx, args) => formatDatetime(args.values),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user