From e40a05efb7726e252862304c6565650221a1ae5c Mon Sep 17 00:00:00 2001 From: joostdecock Date: Thu, 25 Aug 2022 11:13:36 +0200 Subject: [PATCH] fix(plugin-title): Remove ESM-incompatible code --- plugins/plugin-title/src/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/plugin-title/src/index.js b/plugins/plugin-title/src/index.js index 0c73810edea..7bf5d068404 100644 --- a/plugins/plugin-title/src/index.js +++ b/plugins/plugin-title/src/index.js @@ -60,6 +60,7 @@ export default { scale: 1, rotation: 0, } + so = { ...defaults, ...so } so.scale = so.scale * this.context.settings.scale let overwrite = true @@ -93,11 +94,18 @@ export default { .attr('data-text-transform', transform(so.at.shift(-90 - so.rotation, shift * so.scale))) } shift += 6 - const dateformat = require('dateformat') const now = new Date() + let hours = now.getHours() + let mins = now.getMinutes() + if (hours < 10) hours = `0${hours}` + if (mins < 10) mins = `0${mins}` this.points[`_${prefix}_exportDate`] = so.at .shift(-90 - so.rotation, shift * so.scale) - .attr('data-text', dateformat(now, 'yyyymmdd"T"HHMMo')) + .attr('data-text', now.toLocaleDateString( + this.context.settings.locale || 'en', + { weekday: 'long', year: 'numeric', month: 'short', day: 'numeric'} + )) + .attr('data-text', `@ ${hours}:${mins}`) .attr('data-text-class', 'text-sm') .attr('data-text-transform', transform(so.at.shift(-90 - so.rotation, shift * so.scale))) },