Module

JS.Intl.DurationFormat

Package
purescript-js-intl
Repository
pete-murphy/purescript-js-intl

Language-sensitive duration formatting (e.g. "2 hours 30 minutes"). See ECMA-402 §13 DurationFormat Objects and MDN Intl.DurationFormat.

#DurationFormat Source

data DurationFormat

An object that formats durations (years, months, ..., nanoseconds) by locale.

#DurationFormatOptions Source

type DurationFormatOptions :: Row Typetype DurationFormatOptions = (days :: String, daysDisplay :: String, fractionalDigits :: Int, hours :: String, hoursDisplay :: String, localeMatcher :: String, microseconds :: String, microsecondsDisplay :: String, milliseconds :: String, millisecondsDisplay :: String, minutes :: String, minutesDisplay :: String, months :: String, monthsDisplay :: String, nanoseconds :: String, nanosecondsDisplay :: String, numberingSystem :: String, seconds :: String, secondsDisplay :: String, style :: String, weeks :: String, weeksDisplay :: String, years :: String, yearsDisplay :: String)

Options to pass to the DurationFormat constructor (new or new_)

Note: Not all combinations of options are valid. See the specification (https://tc39.es/proposal-intl-duration-format/#durationformat-objects) or the MDN reference (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/DurationFormat)

#ToDurationFormatOptions Source

data ToDurationFormatOptions

Instances

#DurationLike Source

class DurationLike a  where

Types that can be converted to a duration object suitable for DurationFormat. Instances are provided for:

  • Records with any subset of Duration fields (e.g. { hours :: Number, minutes :: Number })
  • Data.Interval.Duration (maps the 7 ISO 8601 components; missing components default to 0.0)
  • Data.Time.Duration.Days, Hours, Minutes, Seconds, Milliseconds

Members

Instances

#format Source

format :: forall duration. DurationLike duration => DurationFormat -> duration -> String

Format a duration

#formatToParts Source

formatToParts :: forall duration. DurationLike duration => DurationFormat -> duration -> Array { type :: String, value :: String }

Allows locale-aware formatting of strings produced by the DurationFormat

#convertOptionsWithDefaults Source

Modules
JS.Intl
JS.Intl.Collator
JS.Intl.DateTimeFormat
JS.Intl.DisplayNames
JS.Intl.DurationFormat
JS.Intl.ListFormat
JS.Intl.Locale
JS.Intl.NumberFormat
JS.Intl.Options.AvailableCanonical
JS.Intl.Options.CaseFirst
JS.Intl.Options.Collation
JS.Intl.Options.CompactDisplay
JS.Intl.Options.CurrencyDisplay
JS.Intl.Options.CurrencySign
JS.Intl.Options.DateStyle
JS.Intl.Options.Day
JS.Intl.Options.DayPeriod
JS.Intl.Options.Days
JS.Intl.Options.DaysDisplay
JS.Intl.Options.DisplayNamesType
JS.Intl.Options.DurationFormatStyle
JS.Intl.Options.Era
JS.Intl.Options.Fallback
JS.Intl.Options.FormatMatcher
JS.Intl.Options.Granularity
JS.Intl.Options.Hour
JS.Intl.Options.HourCycle
JS.Intl.Options.Hours
JS.Intl.Options.HoursDisplay
JS.Intl.Options.Internal.Unsafe
JS.Intl.Options.LanguageDisplay
JS.Intl.Options.ListFormatType
JS.Intl.Options.LocaleMatcher
JS.Intl.Options.Microseconds
JS.Intl.Options.MicrosecondsDisplay
JS.Intl.Options.Milliseconds
JS.Intl.Options.MillisecondsDisplay
JS.Intl.Options.Minute
JS.Intl.Options.Minutes
JS.Intl.Options.MinutesDisplay
JS.Intl.Options.Month
JS.Intl.Options.Months
JS.Intl.Options.MonthsDisplay
JS.Intl.Options.Nanoseconds
JS.Intl.Options.NanosecondsDisplay
JS.Intl.Options.Notation
JS.Intl.Options.NumberFormatStyle
JS.Intl.Options.Numeric
JS.Intl.Options.PluralCategory
JS.Intl.Options.PluralRulesType
JS.Intl.Options.RelativeTimeUnit
JS.Intl.Options.RoundingIncrement
JS.Intl.Options.RoundingMode
JS.Intl.Options.RoundingPriority
JS.Intl.Options.Second
JS.Intl.Options.Seconds
JS.Intl.Options.SecondsDisplay
JS.Intl.Options.Sensitivity
JS.Intl.Options.SignDisplay
JS.Intl.Options.Style
JS.Intl.Options.TimeStyle
JS.Intl.Options.TimeZoneName
JS.Intl.Options.TrailingZeroDisplay
JS.Intl.Options.UnitDisplay
JS.Intl.Options.Usage
JS.Intl.Options.UseGrouping
JS.Intl.Options.Weekday
JS.Intl.Options.Weeks
JS.Intl.Options.WeeksDisplay
JS.Intl.Options.Year
JS.Intl.Options.Years
JS.Intl.Options.YearsDisplay
JS.Intl.PluralRules
JS.Intl.RelativeTimeFormat
JS.Intl.Segmenter
JS.LocaleSensitive.Date
JS.LocaleSensitive.Number
JS.LocaleSensitive.String