Closed Bug 1035754 Opened 8 years ago Closed 7 years ago
[Gaia][lock screen] support 24 hour time format
There will be a setting toggle to let user choose between 12/24 hour time format in v2.1. User story and settings spec: Bug 903683 For each app, the tasks to do after toggle is added would be: 1.Read/listen to the time format toggle value/change event. 2.Input the corresponding time format to existing mozL10n.DateTimeFormat() function. Currently the input time format should be a fixed 12 hour shortTimeFormat = %I:%M %p , line 201 of http://goo.gl/DR4CNe. There will be a 24 hour time format added. 3.Show the return of the function as it's doing now.
To have Greg as assignee for this bug first, will post more details after setting part is done, thanks.
Assignee: nobody → gweng
Test steps: 1. Open settings app 2. change the Time format settings in Settings > Date & Time > Time Format panel Expect: The time format in lock screen will be changed. here's the patch steps to apply correct time format: 1. include navigator.mozHour12 API shim in gaia app's html ``` <script defer src="shared/js/date_time_helper.js"></script> ``` (currently we still need at least `settings: readonly` permission in manifest, which might changed in next release) 2. detect proper time format via mozHour12 API, and get correct time format string from new 'shortTimeFormat12'/'shortTimeFormat24'. ``` var timeFormat = window.navigator.mozHour12 ? _('shortTimeFormat12') : _('shortTimeFormat24'); ``` 3. call mozL10n DateTimeFormat to localize it 4. listen to 'timeformatchange' event and localize time strings when its triggered The full usage is at (WIP) for reference.  https://github.com/mozilla-b2g/gaia/pull/22757/files
Patch sent, thanks!
Attachment #8472836 - Flags: review?(timdream)
Comment on attachment 8472836 [details] [review] Patch date_time_helper.js probably need to load before lock screen to make sure the method exist. I didn't check it. Also, you need to rebase the patch.
Attachment #8472836 - Flags: review?(timdream) → review+
Rebased. Would land it.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
7 years ago
Depends on: 1057812
You need to log in before you can comment on or make changes to this bug.