From 5d9dc1fb88de37f5a10cbff86cca130bd85fc35c Mon Sep 17 00:00:00 2001 From: Benjamin F Date: Wed, 3 Aug 2022 11:30:45 -0700 Subject: [PATCH] Add timestamp to title. --- markdown/dev/reference/plugins/title/en.md | 2 +- markdown/org/docs/various/notation/title/en.md | 2 +- plugins/plugin-title/src/index.js | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/markdown/dev/reference/plugins/title/en.md b/markdown/dev/reference/plugins/title/en.md index a6ea84c5c96..1826f518d32 100644 --- a/markdown/dev/reference/plugins/title/en.md +++ b/markdown/dev/reference/plugins/title/en.md @@ -4,7 +4,7 @@ title: "@freesewing/plugin-title" The **@freesewing/plugin-title** plugin provides [the title macro](/reference/api/macros/title/) which facilitates adding part titles -to your desings. +to your designs. An example of the title macro diff --git a/markdown/org/docs/various/notation/title/en.md b/markdown/org/docs/various/notation/title/en.md index e58cc8e5f1f..baf5092c0f3 100644 --- a/markdown/org/docs/various/notation/title/en.md +++ b/markdown/org/docs/various/notation/title/en.md @@ -2,7 +2,7 @@ title: Titles --- -Each pattern piece has a title that tells you the number and name of the piece, as well as the pattern name: +Each pattern piece has a title that tells you the number and name of the piece, as well as the pattern name and a timestamp of when the pattern was rendered: diff --git a/plugins/plugin-title/src/index.js b/plugins/plugin-title/src/index.js index 38e01fbc541..90cec2bc00e 100644 --- a/plugins/plugin-title/src/index.js +++ b/plugins/plugin-title/src/index.js @@ -92,6 +92,14 @@ export default { .attr('data-text-class', 'fill-current font-bold') .attr('data-text-transform', transform(so.at.shift(-90 - so.rotation, shift * so.scale))) } + shift += 8 + const dateformat = require('dateformat') + const now = new Date() + this.points[`_${prefix}_exportDate`] = so.at + .shift(-90 - so.rotation, shift * so.scale) + .attr('data-text', dateformat(now, 'yyyymmdd"T"HHMMo')) + .attr('data-text-class', 'fill-note') + .attr('data-text-transform', transform(so.at.shift(-90 - so.rotation, shift * so.scale))) }, }, }