Class: ICU4X::DateTimeFormat
- Inherits:
-
Object
- Object
- ICU4X::DateTimeFormat
- Defined in:
- lib/icu4x/yard_docs.rb
Overview
Formats dates and times according to locale-specific conventions.
DateTimeFormat supports various date and time styles and calendar systems. You can use either style options (date_style, time_style) or component options (year, month, day, weekday, hour, minute, second), but not both.
Instance Method Summary collapse
-
#format(time) ⇒ String
Formats a time value according to the configured options.
-
#format_to_parts(time) ⇒ Array<FormattedPart>
Formats a time value and returns an array of parts.
-
#initialize(locale, provider: nil, date_style: nil, time_style: nil, year: nil, month: nil, day: nil, weekday: nil, hour: nil, minute: nil, second: nil, time_zone: nil, calendar: :gregory, hour_cycle: nil, hour12: nil) ⇒ DateTimeFormat
constructor
Creates a new DateTimeFormat instance.
-
#resolved_options ⇒ Hash
Returns the resolved options for this instance.
Constructor Details
#initialize(locale, provider: nil, date_style: nil, time_style: nil, year: nil, month: nil, day: nil, weekday: nil, hour: nil, minute: nil, second: nil, time_zone: nil, calendar: :gregory, hour_cycle: nil, hour12: nil) ⇒ DateTimeFormat
Creates a new DateTimeFormat instance.
You must specify either style options (date_style/time_style) or component options (year, month, day, weekday, hour, minute, second). These are mutually exclusive.
587 588 589 590 |
# File 'lib/icu4x/yard_docs.rb', line 587 def initialize(locale, provider: nil, date_style: nil, time_style: nil, year: nil, month: nil, day: nil, weekday: nil, hour: nil, minute: nil, second: nil, time_zone: nil, calendar: :gregory, hour_cycle: nil, hour12: nil); end |
Instance Method Details
#format(time) ⇒ String
Formats a time value according to the configured options.
597 |
# File 'lib/icu4x/yard_docs.rb', line 597 def format(time); end |
#format_to_parts(time) ⇒ Array<FormattedPart>
Formats a time value and returns an array of parts.
Each part contains a type and value, allowing for custom styling or processing of individual components.
626 |
# File 'lib/icu4x/yard_docs.rb', line 626 def format_to_parts(time); end |
#resolved_options ⇒ Hash
Returns the resolved options for this instance.
645 |
# File 'lib/icu4x/yard_docs.rb', line 645 def ; end |