Get started with intl CDN

MIT licensed

Intl: library for internationalization - formatting dates, numbers, currencies.

Tags:
  • intl
  • i18n
  • internationalization
  • ecma402
  • polyfill

Stable version

Copied!

How to start using intl CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with intl CDN - cdnhub.io</title>
    <script src="https://cdn.cdnhub.io/intl/1.2.5/Intl.min.js"></script>
</head>
<body>
    <script>
        const numberFormat = new Intl.NumberFormat('en-US', {
            style: 'currency',
            currency: 'USD'
        });

        const price = 123.45;
        const formattedPrice = numberFormat.format(price);
        console.log(formattedPrice); // Output: $123.45

        const dateFormat = new Intl.DateTimeFormat('en-US', {
            year: 'numeric',
            month: 'long',
            day: 'numeric',
            weekday: 'long',
            hour: 'numeric',
            minute: 'numeric',
            hour12: true
        });

        const date = new Date();
        const formattedDate = dateFormat.format(date);
        console.log(formattedDate); // Output: Thursday, January 26, 2023 12:34 PM
    </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions