Module: ICU::TimeFormatting
- Defined in:
- lib/ffi-icu/time_formatting.rb
Defined Under Namespace
Classes: BaseFormatter, DateTimeFormatter
Constant Summary collapse
- TZ_MAP =
{ # The generic location format. # Where that is unavailable, falls back to the long localized GMT format ("OOOO"; # Note: Fallback is only necessary with a GMT-style Time Zone ID, like Etc/GMT-830.), # This is especially useful when presenting possible timezone choices for user selection, # since the naming is more uniform than the "v" format. # such as "United States Time (New York)", "Italy Time" generic_location: 'VVVV', # The long generic non-location format. # Where that is unavailable, falls back to generic location format ("VVVV")., such as "Eastern Time". generic_long: 'vvvv', # The short generic non-location format. # Where that is unavailable, falls back to the generic location format ("VVVV"), # then the short localized GMT format as the final fallback., such as "ET". generic_short: 'v', # The long specific non-location format. # Where that is unavailable, falls back to the long localized GMT format ("OOOO"). specific_long: 'zzzz', # The short specific non-location format. # Where that is unavailable, falls back to the short localized GMT format ("O"). specific_short: 'z', # The ISO8601 basic format with hours, minutes and optional seconds fields. # The format is equivalent to RFC 822 zone format (when optional seconds field is absent). # This is equivalent to the "xxxx" specifier. basic: 'Z', # The long localized GMT format. This is equivalent to the "OOOO" specifier, such as GMT-8:00 localized_long: 'ZZZZ', # The ISO8601 extended format with hours, minutes and optional seconds fields. # The ISO8601 UTC indicator "Z" is used when local time offset is 0. # This is equivalent to the "XXXXX" specifier, such as -08:00 -07:52:58 extended: 'ZZZZZ', localized_short: 'O', # The short localized GMT format, such as GMT-8 localized_longO: 'OOOO', # The long localized GMT format, such as GMT-08:00 # The short time zone ID. Where that is unavailable, # the special short time zone ID unk (Unknown Zone) is used. # Note: This specifier was originally used for a variant of the short specific non-location format, # but it was deprecated in the later version of this specification. In CLDR 23, the definition # of the specifier was changed to designate a short time zone ID, such as uslax tz_id_short: 'V', tz_id_long: 'VV', # The long time zone ID, such as America/Los_Angeles # The exemplar city (location) for the time zone. Where that is unavailable, # the localized exemplar city name for the special zone Etc/Unknown is used as the fallback # (for example, "Unknown City"), such as Los Angeles # see: http://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns city_location: 'VVV' }.freeze
- HOUR_CYCLE_SYMS =
{ 'h11' => 'K', 'h12' => 'h', 'h23' => 'H', 'h24' => 'k', :locale => 'j' }.freeze
Class Method Summary collapse
- .clear_default_options ⇒ Object
- .create(options = {}) ⇒ Object
- .format(datetime, options = {}) ⇒ Object
-
.set_default_options(options) ⇒ Object
rubocop:disable Naming/AccessorMethodName.
Class Method Details
.clear_default_options ⇒ Object
67 68 69 |
# File 'lib/ffi-icu/time_formatting.rb', line 67 def self. @default_options.clear end |
.create(options = {}) ⇒ Object
63 64 65 |
# File 'lib/ffi-icu/time_formatting.rb', line 63 def self.create( = {}) DateTimeFormatter.new(@default_options.merge()) end |
.format(datetime, options = {}) ⇒ Object
75 76 77 |
# File 'lib/ffi-icu/time_formatting.rb', line 75 def self.format(datetime, = {}) create(@default_options.merge()).format(datetime) end |
.set_default_options(options) ⇒ Object
rubocop:disable Naming/AccessorMethodName
71 72 73 |
# File 'lib/ffi-icu/time_formatting.rb', line 71 def self.() # rubocop:disable Naming/AccessorMethodName @default_options.merge!() end |