dojo/date/locale::addCustomFormats()

Project owner:Adam Peller
Authors:Seth Lytle, Adam Peller, Marcus Reimann

Adds a reference to a bundle containing localized custom formats to be used by date/time formatting and parsing routines.

Introduction

The user may add custom localized formats where the bundle has properties following the same naming convention used by dojo/cldr: dateFormat-xxxx / timeFormat-xxxx and the pattern string should match that format. See dojo/date/locale::format() for details. The resources must be loaded by via the dojo/i18n prior to use.

Usage

require(["dojo/_base/kernel", "dojo/date/locale", "dojo/i18n"], function(kernel, locale, i18n){
  var bundle = {
    timeFormat-custom: "HH:mm:ss.zzzz",
    dateFormat-custom: "d-MMMM-y"
  };
  i18n.cache["mypackage/nls/gregorian/" + kernel.locale] = bundle;
  locale.addCustomFormats("mypackage", "gregorian");
});
Error in the documentation? Can’t find what you are looking for? Let us know!