Flutter macOS Embedder
FlutterHourFormat Class Reference

#import <FlutterHourFormat.h>

Inheritance diagram for FlutterHourFormat:

Class Methods

(BOOL) + isAlwaysUse24HourFormat
 

Detailed Description

Definition at line 10 of file FlutterHourFormat.h.

Method Documentation

◆ isAlwaysUse24HourFormat

+ (BOOL) isAlwaysUse24HourFormat

Definition at line 8 of file FlutterHourFormat.mm.

8  {
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 }

The documentation for this class was generated from the following files: