Document time date placeholder transforms
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile, web, pulse-signage-web) (push) Successful in 1m15s
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile.player, player, pulse-signage-player) (push) Successful in 35s

This commit is contained in:
2026-09-14 00:07:49 +01:00
parent 222162df57
commit 1e317997c4
4 changed files with 32 additions and 3 deletions
+1
View File
@@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
- Fixed the template designer empty background message moving when the background image is removed. - Fixed the template designer empty background message moving when the background image is removed.
- Fixed cached API and RSS images not being served by the player after being downloaded. - Fixed cached API and RSS images not being served by the player after being downloaded.
- Fixed blank time/date regions displaying the default clock format on the player. - Fixed blank time/date regions displaying the default clock format on the player.
- Fixed the time/date placeholder popup omitting text and math transform help.
## 2.13.2 - 2026-09-11 ## 2.13.2 - 2026-09-11
+1 -1
View File
@@ -203,7 +203,7 @@ function getTimeDateFormattedParts(timeZone, date) {
dddd: toTitleCase(getPart(weekdayLong, 'weekday')), dddd: toTitleCase(getPart(weekdayLong, 'weekday')),
MMM: toTitleCase(getPart(monthShort, 'month')), MMM: toTitleCase(getPart(monthShort, 'month')),
MMMM: toTitleCase(getPart(monthLong, 'month')), MMMM: toTitleCase(getPart(monthLong, 'month')),
a: toTitleCase(getPart(ampm, 'dayPeriod')), a: String(getPart(ampm, 'dayPeriod') || '').toLowerCase(),
tz: getPart(timezoneShort, 'timeZoneName'), tz: getPart(timezoneShort, 'timeZoneName'),
tz_long: resolvedTimeZone, tz_long: resolvedTimeZone,
date: getPart(numericParts, 'year') + '-' + getPart(numericParts, 'month') + '-' + getPart(numericParts, 'day'), date: getPart(numericParts, 'year') + '-' + getPart(numericParts, 'month') + '-' + getPart(numericParts, 'day'),
+5 -2
View File
@@ -155,7 +155,7 @@
dddd: toTitleCase(getPart(weekdayLong, 'weekday')), dddd: toTitleCase(getPart(weekdayLong, 'weekday')),
MMM: toTitleCase(getPart(monthShort, 'month')), MMM: toTitleCase(getPart(monthShort, 'month')),
MMMM: toTitleCase(getPart(monthLong, 'month')), MMMM: toTitleCase(getPart(monthLong, 'month')),
a: toTitleCase(getPart(ampm, 'dayPeriod')), a: String(getPart(ampm, 'dayPeriod') || '').toLowerCase(),
tz: getPart(getFormatter('tz-short:' + resolvedTimeZone, { tz: getPart(getFormatter('tz-short:' + resolvedTimeZone, {
timeZone: resolvedTimeZone, timeZone: resolvedTimeZone,
timeZoneName: 'short' timeZoneName: 'short'
@@ -296,7 +296,10 @@
var table = '<div class="table-responsive"><table class="table table-sm align-middle mb-0"><thead><tr><th>Placeholder</th><th>Output</th><th>Description</th></tr></thead><tbody>' + placeholders.map(function (item) { var table = '<div class="table-responsive"><table class="table table-sm align-middle mb-0"><thead><tr><th>Placeholder</th><th>Output</th><th>Description</th></tr></thead><tbody>' + placeholders.map(function (item) {
return '<tr><td><code>{{' + escapeHtml(item.token) + '}}</code></td><td>' + escapeHtml(item.output) + '</td><td>' + escapeHtml(item.description) + '</td></tr>'; return '<tr><td><code>{{' + escapeHtml(item.token) + '}}</code></td><td>' + escapeHtml(item.output) + '</td><td>' + escapeHtml(item.description) + '</td></tr>';
}).join('') + '</tbody></table></div>'; }).join('') + '</tbody></table></div>';
return window.placeholderInfo.render(regionId, 'Time and date placeholders', table); var transforms = '' +
(typeof window.placeholderInfo.renderTextTransforms === 'function' ? window.placeholderInfo.renderTextTransforms() : '') +
(typeof window.placeholderInfo.renderMathTransforms === 'function' ? window.placeholderInfo.renderMathTransforms() : '');
return window.placeholderInfo.render(regionId, 'Time and date placeholders', table + transforms);
} }
function renderEditorCard(context) { function renderEditorCard(context) {
+25
View File
@@ -64,6 +64,31 @@ test('time/date region renders placeholder tokens on the player side', () => {
assert.match(markup, /<p>\d{2}:\d{2}<\/p>/); assert.match(markup, /<p>\d{2}:\d{2}<\/p>/);
}); });
test('time/date lowercase day period renders in lowercase', () => {
const module = loadTimeDateModule();
const markup = module.renderRegion(
{
pixelWidth: 320,
pixelHeight: 180,
canvasScale: 1,
baseStyle: 'position:absolute;'
},
{
value: '{{a}}',
timezone: 'UTC'
}
);
assert.match(markup, /<p>(am|pm)<\/p>/);
});
test('time/date editor popup documents text and math transforms', () => {
const editorSource = fs.readFileSync(require.resolve('../src/web/public/js/regions/type/time-date.js'), 'utf8');
assert.match(editorSource, /renderTextTransforms\(\)/);
assert.match(editorSource, /renderMathTransforms\(\)/);
});
test('time/date region stays blank when its format is blank', () => { test('time/date region stays blank when its format is blank', () => {
const module = loadTimeDateModule(); const module = loadTimeDateModule();
const markup = module.renderRegion( const markup = module.renderRegion(