Closed
Bug 1172703
Opened 9 years ago
Closed 9 years ago
navigator.mozHour12 should not have a default value.
Categories
(Firefox OS Graveyard :: Gaia::Settings, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: zbraniecki, Assigned: zbraniecki)
References
Details
(Whiteboard: [p=1])
Attachments
(1 file)
+++ This bug was initially created as a clone of Bug #1057194 +++
(In reply to Arthur Chen [:arthurcc] from bug 1057194 comment #2)
> I just thought that the script is for creating a shim for mozHour12 so it
> should at least have a default value "null" instead of leaving it as
> undefined. r=me with the comment addressed, thanks!
I'd like to provide a counter argument here. We want to transition Gaia to use Intl API, and it uses options hash with hour12 as one of the options. It would be nice to do:
Intl.DateTimeFormat(navigator.languages, {
hour: 'numeric',
minute: 'numeric',
hour12: navigator.mozHour12
});
but that will work as expected (as in, it will pick the default for a given locale) only if the default value is undefined. If it's null, it's falsy and we have to do:
var options = {
hour: 'numeric',
minute: 'numeric',
};
if (typeof navigator.mozHour12 === 'boolean') {
options.hour12 = navigator.mozHour12;
}
Intl.DateTimeFormat(navigator.languages, options);
Assignee | ||
Comment 1•9 years ago
|
||
Assignee: nobody → gandalf
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•9 years ago
|
||
Comment on attachment 8616958 [details]
pull request
Arthur, does it convince you?
Attachment #8616958 -
Flags: review?(arthur.chen)
Comment 3•9 years ago
|
||
Comment on attachment 8616958 [details]
pull request
Thanks for the patch, zibi! I'm currently in the middle of reviewing another major patch, EJ will help review this patch. EJ, thanks!
Attachment #8616958 -
Flags: review?(arthur.chen) → review?(ejchen)
Comment on attachment 8616958 [details]
pull request
Interesting, r+ for this. thanks.
Attachment #8616958 -
Flags: review?(eragonj+moz) → review+
Assignee | ||
Comment 5•9 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•