erickguan / ffi-icu

FFI wrappers for ICU. MRI extension with the dynamic C library.
https://github.com/erickguan/ffi-icu
MIT License
35 stars 22 forks source link

Add support for skeleton date patterns #46

Closed damiann closed 3 years ago

damiann commented 3 years ago

Users will be able to provide skeleton patterns to allow for a variety of date formats.

Usage: formatter = ICU::TimeFormatting.create(:locale => 'fr_FR', :date => :pattern, :time => :pattern, :skeleton => 'MMMMy') formatter.format(Time.now) => "août 2021"

Pattern examples: 'MMMd' => 'Oct. 31' 'MMMMy' => 'October 2021' 'y' => '2021'

C code example: https://unicode-org.github.io/icu/userguide/format_parse/datetime/examples.html#c-7