Flutter iOS Embedder
FlutterHourFormat.mm
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
6 
7 @implementation FlutterHourFormat
9  // iOS does not report its "24-Hour Time" user setting in the API. Instead, it applies
10  // it automatically to NSDateFormatter when used with [NSLocale currentLocale]. It is
11  // essential that [NSLocale currentLocale] is used. Any custom locale, even the one
12  // that's the same as [NSLocale currentLocale] will ignore the 24-hour option (there
13  // must be some internal field that's not exposed to developers).
14  //
15  // Therefore this option behaves differently across Android and iOS. On Android this
16  // setting is exposed standalone, and can therefore be applied to all locales, whether
17  // the "current system locale" or a custom one. On iOS it only applies to the current
18  // system locale. Widget implementors must take this into account in order to provide
19  // platform-idiomatic behavior in their widgets.
20  NSString* dateFormat = [NSDateFormatter dateFormatFromTemplate:@"j"
21  options:0
22  locale:[NSLocale currentLocale]];
23  return [dateFormat rangeOfString:@"a"].location == NSNotFound;
24 }
25 
26 @end
FlutterHourFormat.h
FlutterHourFormat
Definition: FlutterHourFormat.h:10
+[FlutterHourFormat isAlwaysUse24HourFormat]
BOOL isAlwaysUse24HourFormat()
Definition: FlutterHourFormat.mm:8