Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@telerik/kendo-intl

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@telerik/kendo-intl

A package exporting functions for date and number parsing and formatting

  • 0.10.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
75K
decreased by-19.49%
Maintainers
1
Weekly downloads
 
Created
Source

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 using Unicode Common Locale Data Repository (CLDR) data, which are split into the following modules:

  • CLDR
  • Date Parsing
  • Date Formatting
  • Number Parsing
  • Number Formatting

Basic Usage

CLDR Data

The cldr-data module is required in order to download the full CDLR database.

npm install --save cldr-data

To use the methods for different locales, use the load method to load the likelySubtags and locale data. Additionally, the library requires the loading of the supplemental currencyData for the default currency formatting and the weekData for the day of week formatting.

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

load(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/timeZoneNames.json"),
     require("cldr-data/supplemental/likelySubtags.json"),
     require("cldr-data/supplemental/currencyData.json"),
     require("cldr-data/supplemental/weekData.json"));

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

Date Parsing

Date parsing converts a string to a Date object using the locale specific settings.

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 parsing converts a Date object to a human-readable string using the locale specific settings.

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 to a Number object 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 to a human-readable string using the locale specific settings.

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.

Installation

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

Install it using NPM.

npm install --save '@telerik/kendo-intl';

Once installed, import the 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;

To install the npm package, you use Node.js 5.0.0 or later versions.

Keywords

FAQs

Package last updated on 26 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc