npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@telerik/kendo-intl

v2.3.1

Published

A package exporting functions for date and number parsing and formatting

Downloads

322,213

Readme

Commitizen friendly Build Status npm version

Kendo UI Internationalization

This repository contains the source code and documentation of the Kendo UI Internationalization package.

It includes methods for parsing and formatting dates and numbers by using Unicode Common Locale Data Repository (CLDR) data. These methods are split into the following modules:

Basic Usage

CLDR Data

To download the full CDLR database, you need to install the cldr-data module by running the following command.

npm install --save cldr-data

To apply the methods for different locales, load the likelySubtags and the locale data by using the load method.

Additionally, the library requires you to load:

  • The supplemental currencyData for the default currency formatting.
  • The weekData for the day of week formatting.
import { load } from '@telerik/kendo-intl';

load(
    require("cldr-data/supplemental/likelySubtags.json"),
    require("cldr-data/supplemental/currencyData.json"),
    require("cldr-data/supplemental/weekData.json"),

    require("cldr-data/main/bg/numbers.json"),
    require("cldr-data/main/bg/currencies.json"),
    require("cldr-data/main/bg/ca-gregorian.json"),
    require("cldr-data/main/bg/dateFields.json"),
    require("cldr-data/main/bg/timeZoneNames.json")
);

For more examples and available configuration options, refer to the article on CLDR Data.

Date Parsing

Date parsing converts a string into a Date object by using the specific settings of the locale.

import { parseDate } from '@telerik/kendo-intl';

parseDate("11/6/2000", ["G", "d"]); // Mon Nov 06 2000
parseDate("Montag, 6.11.2000", "EEEE, d.MM.y", "de"); // Mon Nov 06 2000
parseDate("2000-11-06T10:30Z"); // Mon Nov 06 2000 12:30

For more examples and available configuration options, refer to the article on date parsing.

Date Formatting

Date formatting converts a Date object into a human-readable string by using the specific settings of the locale.

import { formatDate } from '@telerik/kendo-intl';

formatDate(new Date(2000, 10, 6), "d"); // 11/6/2000
formatDate(new Date(2000, 10, 6), "yMd", "de"); // 6.11.2000
formatDate(new Date(2000, 10, 6), "EEEE, d.MM.y", "bg"); // понеделник, 6.11.2000

For more examples and available configuration options, refer to the article on date formatting.

Number Parsing

Number parsing converts a string into a Number object by using the specific settings of the locale.

import { parseNumber } from '@telerik/kendo-intl';

parseNumber("12.22"); // 12.22
parseNumber("1.212,22 €", "de"); // 1212.22
parseNumber("10.22 %"); // 0.1022
parseNumber("1,0000123e+4", "bg"); // 10000.123

For more examples and available configuration options, refer to the article on number parsing.

Number Formatting

Number formatting converts a Number object into a human-readable string using the specific settings of the locale.

import { formatNumber } from '@telerik/kendo-intl';

formatNumber(1234.567, "n2"); // 1,234.57

formatNumber(1234.567, "c", "de"); // 1.234,57 €

formatNumber(1234.567, {
   style: "currency",
   currency: "USD",
   currencyDisplay: "displayName"
}, "bg"); // 1 234,57 щатски долара

formatNumber(2345678, "##,#.00"); // 2,345,678.00

For more examples and available configuration options, refer to the article on number formatting.

General Formatting

General formatting provides methods for independent placeholder and type formatting by using the specific settings of the locale.

import { format, toString } from '@telerik/kendo-intl';

format('Date: {0:d} - Price: {1:c}', [new Date(), 10.5], "en") // Date: 1/5/2017 - Price: $10.50

toString(10.5, "c", "bg"); // 10,50 лв.

toString(new Date(), "d"); // 1/5/2017

For more examples and available configuration options, refer to the article on general formatting.

Installation

  1. The Internationalization library is published as a scoped NPM package in the NPMJS Telerik account.

  2. Download and install the module:

    npm install --save '@telerik/kendo-intl';
  3. Once installed, import the Internationalization in your application root module:

    // ES2015 module syntax
    import { formatDate, parseDate } from '@telerik/kendo-intl';
    //or
    import { formatNumber, parseNumber } from '@telerik/kendo-intl';
    // CommonJS format
    var numbers = require('@telerik/kendo-intl/number').numbers;
    //or
    var dates = require('@telerik/kendo-intl/dates').dates;