Skip to content

Commit

Permalink
Simplify DateTimeFormat::resolvedOptions
Browse files Browse the repository at this point in the history
Summary:
1. Remove `numeric`, which is not a real option per the spec, and is
hard-coded to false here anyway.
2. Remove some unnecessary if/else.

Reviewed By: jpporto

Differential Revision: D37894494

fbshipit-source-id: 5788cdf78c7b8f6aa323c1565a251dd5e0607174
  • Loading branch information
neildhar authored and cortinico committed Jul 20, 2022
1 parent 303d793 commit bc97c53
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/Platform/Intl/PlatformIntlApple.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1456,18 +1456,13 @@ uint8_t getCurrencyDigits(std::u16string_view code) {
Options DateTimeFormat::resolvedOptions() noexcept {
Options options;
options.emplace(u"locale", Option(impl_->locale));
options.emplace(u"numeric", Option(false));
options.emplace(u"timeZone", Option(impl_->timeZone));
if (impl_->calendar)
options.emplace(u"calendar", Option(*impl_->calendar));

if (impl_->hourCycle.has_value()) {
options.emplace(u"hourCycle", *impl_->hourCycle);
if (impl_->hourCycle == u"h11" || impl_->hourCycle == u"h12") {
options.emplace(u"hour12", true);
} else {
options.emplace(u"hour12", false);
}
options.emplace(
u"hour12", impl_->hourCycle == u"h11" || impl_->hourCycle == u"h12");
}
if (impl_->weekday.has_value())
options.emplace(u"weekday", *impl_->weekday);
Expand Down

0 comments on commit bc97c53

Please sign in to comment.