Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

%dateformat% doesn't show leading zeros #3

RealRaven2000 opened this issue Aug 5, 2019 · 3 comments


Copy link

@RealRaven2000 RealRaven2000 commented Aug 5, 2019

Das alte %dateshort% hatte folgendes Format:
z.B. 01.01.2019 01:01:01 (Sekunden bin ich unsicher)
auch lt. Beschreibung:
%dateshort% = Kurzformat Datum und Zeit (z.B. 01.01.2000 1:23:45)

wobei hier in der Beschreibung die führende Null bei den Stunden fehlt.

Aktuell liefert %dateshort%
für das Datum kurze Zahlen, also ohne führende Nullen und zwischen Tag und Zeit ist ein Komma, Sekunden sind entfallen
z.B. 4.7.2019, 09:03

Request: Tag und Monat wieder mit führende Nullen; der Entfall der Sekunden ist begrüßenswert

Ein Workaround wäre %d%.%m%.%Y% %H%:%M% allerdings müsste das mehrfach an einigen Rechnern geändert werden


This comment has been minimized.

Copy link
Owner Author

@RealRaven2000 RealRaven2000 commented Aug 5, 2019

These settings come directly from the OS - it used to be generated by sIScriptableDateFormat, but this has sadly been removed in Gecko57 by Mozilla.

The date options for datelocal and dateshort are currently:
hour12: false, //
hour: "numeric",
minute: "2-digit"
dateStyle: "full"
datelocal - specific:
dateOptions.weekday = "long"; = "numeric";
dateOptions.month = "short";
dateOptions.year = "numeric";

dateshort - specific: = "numeric";
dateOptions.month = "numeric";
dateOptions.year = "numeric";

the currentt formatting function is Intl.DateFormat, which is described here:

which result in the following (German) date texts:
Local Date: Montag, 5. Aug. 2019, 15:58
Short Date: 5.8.2019, 15:58

the easiest way to force 2 digits is using "wrapped deferred" variables which are now supported by all licensed versions of SmartTemplate

%dateformat(d.m.Y k:M)%

(the "green" field will be automatically replaced by the normal date on sending, or you can use the "clean variables" (Variablen räumen) toolbar button or right-click the field and select "Aktualisieren und durch Inhalt ersetzen" to replace with current time.


This comment has been minimized.

Copy link
Owner Author

@RealRaven2000 RealRaven2000 commented Aug 6, 2019

I added some switches to the formatting function which can be configured using the following (about:config) variables. I may build a "date settings" UI in the options screen for these later. Heere the settings with their defaults:

extensions.smartTemplate4.dateformat.hour = "numeric" = "numeric"
extensions.smartTemplate4.dateformat.month = "numeric"
extensions.smartTemplate4.dateformat.year = "numeric"

hour: change to "2-digit" for forcing 2digit hours in datelocal / dateshort
day: change to "2-digit" for forcing 2digit day in datelocal / dateshort
month: change to "2-digit" for forcing 2digit month in dateshort only
year: change to "2-digit" for forcing 2digit dateshort only

I also fixed the language setting function, see issue #5

2.2 prerelease

@RealRaven2000 RealRaven2000 changed the title dateformat doesn't show leading 0s %dateformat% doesn't show leading zeros Aug 7, 2019
@RealRaven2000 RealRaven2000 self-assigned this Aug 10, 2019

This comment has been minimized.

Copy link
Owner Author

@RealRaven2000 RealRaven2000 commented Aug 11, 2019

Resolved with Release 2.2 - just submitted to ATN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.