You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace dayjs with temporal-kit v0.2.1 for modern date/time handling using
the TC39 Temporal proposal. Add TemporalHelper.mjs with formatting utilities.
Breaking changes:
- Config: `displayLastUpdateFormat` (string) → `displayLastUpdateOptions` (object)
- Config: New `language` option (defaults to MagicMirror's config.language)
Improvements:
- Modern ES syntax: nullish coalescing (??), simplified conditionals
- Better parameter naming (departure → when for clarity)
- Convert Temporal to Date for hafas-client compatibility
- All 55 tests updated and passing
Closes#253
updatesEvery: 120,// How often should the table be updated in s?
19
19
timeFormat: config.timeFormat,// Since we don't use moment.js, we need to handle the time format ourselves. This is the default time format of the mirror.
20
+
language: config.language,// Use MagicMirror's language setting for date/time formatting
20
21
21
22
// Header
22
23
headerPrefix: "",
23
24
headerAppendix: "",
24
25
25
26
// Display last update time
26
27
displayLastUpdate: true,// Add line after the tasks with the last server update time
27
-
displayLastUpdateFormat: "dd - HH:mm:ss",// Format to display the last update. See dayjs.js documentation for all display possibilities
28
+
displayLastUpdateOptions: {// Intl.DateTimeFormat options for last update display
29
+
weekday: "short",// e.g., "Mon" or "Mo"
30
+
hour: "2-digit",
31
+
minute: "2-digit",
32
+
second: "2-digit"
33
+
},
28
34
29
35
// Error handling
30
36
discardSocketErrorThreshold: 3,// How many consecutive socket errors should be tolerated before showing an error message? (0 = show errors immediately)
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -150,7 +150,7 @@ The module is quite configurable. The only option you really have to set is `sta
150
150
|`customLineStyles`| <p>A string value describing the name of a custom CSS file.</p><p>**Type:**`string`<br>**Example:**`"dresden"`<br>**Default value:**`"leipzig"`</p><p>**Note:** If the setting `showColoredLineSymbols` is `true` the module will try to use colored labels for the line name. Per default it uses the colors used in Leipzig. This style works best if `showOnlyLineNumbers` is set to `true`. If it doesn’t suit your taste you can provide your own settings. See [Providing a custom CSS file](#providing-a-custom-css-file).</p>|
151
151
|`showOnlyLineNumbers`| <p>A boolean value denoting whether the line name should be displayed as a number only or the full name should be used.</p><p>**Type:**`boolean`<br>**Default value:**`false`<br>**Possible values:**`true` and `false`</p><p>**Note:** If set to `true` the module will try to separate line numbers from the line name and display only these. If the line name is “STR 11” only “11” will be displayed. This only works if there are blanks present in the line name. This setting is only tested with departures in Leipzig. If you encounter problems [let me know](https://github.com/KristjanESPERANTO/MMM-PublicTransportHafas/issues).</p>|
152
152
|`displayLastUpdate`| <p>If true this will display the last update time at the end of the task list. See screenshot above</p><p>**Type:**`boolean`<br>**Default value:**`true`<br>**Possible values:**`true` and `false`</p>|
153
-
|`displayLastUpdateFormat`| <p>Format to use for the time display if displayLastUpdate:true</p><p>**Type:**`string`<br>**Example:**`'HH:mm:ss'`<br>**Default value:**`'dd - HH:mm:ss'`</p>See [dayjs.js formats](https://day.js.org/docs/en/parse/string-format) for the other format possibilities.</p>|
153
+
|`displayLastUpdateOptions`| <p>Options object for formatting the last update time using [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#options).</p><p>**Type:**`object`<br>**Default value:**`{ weekday: "short", hour: "2-digit", minute: "2-digit", second: "2-digit" }`<br>**Examples:**<br>- Time only: `{ hour: "2-digit", minute: "2-digit" }`<br>- With date: `{ month: "short", day: "2-digit", hour: "2-digit", minute: "2-digit" }`<br>- Short format: `{ dateStyle: "short", timeStyle: "short" }`</p>See [MDN Intl.DateTimeFormat options](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#options) for all available formatting options.</p>|
154
154
|`animationSpeed`| <p>Speed of the update animation.</p><p>**Type:**`integer`<br>**Possible values:**`0` - `5000`<br>**Default value:**`2000`<br>**Unit:**`milliseconds`</p>|
0 commit comments