How to use the @opuscapita/i18n/lib/converters/DateConverter function in @opuscapita/i18n

To help you get started, we’ve selected a few @opuscapita/i18n examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OpusCapita / react-dates / src / client / components / DateInputField / DateInputField.react.js View on Github external
validate(dateString, dateFormat) {
    const i18nCompatibleFormat = dateFormat.replace(/D/g, 'd').replace(/Y/g, 'y');
    const dc = new DateConverter(i18nCompatibleFormat);

    try {
      const date = dc.stringToValue(dateString);
      const value = !dateString.length ? null : date;
      this.props.onChange(value);
    } catch (err) {
      this.props.onError(err.message);
    }
  }

@opuscapita/i18n

OpusCapita simple i18n mechanism

Apache-2.0
Latest version published 10 months ago

Package Health Score

56 / 100
Full package analysis

Similar packages