Skip to content

Supprot for CLDR 'Stand-Alone' forms #111

Description

@zyavva

I'm missing support for CLDR 'Stand-Alone' forms as specified at http://cldr.unicode.org/translation/date-time#TOC-Stand-Alone-vs.-Format-Styles .
As far i could investigate, 'js-joda-locale' properly recognize defined by pattern 'standalone' styles e.g. "SHORT" vs '"SHORT_STANDALONE" but this informatin is lost while reading values form 'cldrjs'.
Package 'cldr-data' seems to have all necessary data.
My use case for Catalan language is ( ES 6 ):

import { DateTimeFormatter, LocalDate } from 'js-joda';
import { Locale } from '@js-joda/locale';


const catalanShortStandaloneMonth = DateTimeFormatter.ofPattern('EEE d LLL y').withLocale(new Locale('ca'));
const catalanShortMonth = DateTimeFormatter.ofPattern('EEE d MMM y').withLocale(new Locale('ca'));

LocalDate.of(2018, 1, 1).format(catalanShortStandaloneMonth); // expecting 'dl. 1 gen. 2018'
LocalDate.of(2018, 2, 6).format(catalanShortStandaloneMonth); // expecting 'dt. 6 febr. 2018'
LocalDate.of(2018, 3, 7).format(catalanShortStandaloneMonth); // expecting 'dc. 7 març 2018'

LocalDate.of(2018, 1, 1).format(catalanShortMonth); // expecting 'dl. 1 de gen. 2018'
LocalDate.of(2018, 2, 6).format(catalanShortMonth); // expecting 'dt. 6 de febr. 2018'
LocalDate.of(2018, 3, 7).format(catalanShortMonth); // expecting 'dc. 7 de març 2018'

Btw I'm not sure if I'm properly using 'Locale' API.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions