summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@update.uu.se>2020-04-12 12:47:38 +0200
committerMarcus Lundblad <ml@update.uu.se>2020-04-12 12:47:38 +0200
commit9f46f444fcaeb866d4a207b00c5df81faa0ad1d0 (patch)
treef2492bd1a33a1704bd2fdd189647c2f68a8cd1c1 /src
parentca1bc43336b8e0c63c9d598a1775a64bb6125dcb (diff)
downloadgnome-maps-9f46f444fcaeb866d4a207b00c5df81faa0ad1d0.tar.gz
transitOpetionsPanel: Use localized digits for time entrywip/mlundblad/locale-transit-time-entry
Diffstat (limited to 'src')
-rw-r--r--src/transitOptionsPanel.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/transitOptionsPanel.js b/src/transitOptionsPanel.js
index 3039b40a..6c23a3ee 100644
--- a/src/transitOptionsPanel.js
+++ b/src/transitOptionsPanel.js
@@ -36,6 +36,10 @@ const CLOCK_FORMAT_KEY = 'clock-format';
let _desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
let clockFormat = _desktopSettings.get_string(CLOCK_FORMAT_KEY);
+const _timeFormat = new Intl.DateTimeFormat([], { hour: '2-digit',
+ minute: '2-digit',
+ hour12: clockFormat === '12h' });
+
var TransitOptionsPanel = GObject.registerClass({
Template: 'resource:///org/gnome/Maps/ui/transit-options-panel.ui',
InternalChildren: ['transitTimeOptionsComboBox',
@@ -99,7 +103,7 @@ var TransitOptionsPanel = GObject.registerClass({
this._transitDateButton.visible = true;
if (!this._timeSelected)
- this._updateTransitTimeEntry(GLib.DateTime.new_now_local());
+ this._transitTimeEntry.text = _timeFormat.format(new Date());
if (!this._dateSelected)
this._updateTransitDateButton(GLib.DateTime.new_now_local());
@@ -112,13 +116,6 @@ var TransitOptionsPanel = GObject.registerClass({
}
}
- _updateTransitTimeEntry(time) {
- if (clockFormat === '24h')
- this._transitTimeEntry.text = time.format('%R');
- else
- this._transitTimeEntry.text = time.format('%r');
- }
-
_onTransitTimeEntryActivated() {
let timeString = this._transitTimeEntry.text;