JSPM

@dipser/wmlang.js

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q24883F
  • License MIT

Translate months and weekdays with Intl.

Package Exports

  • @dipser/wmlang.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@dipser/wmlang.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

wmlang.js

Demo

http://tools.bitfertig.de/wmlang.js/

Install

npm i @dipser/wmlang.js

Usage

<script type="module">
import { month, weekday } from '@dipser/wmlang.js';
console.log( weekday(1, 'de') ); // => Montag
console.log( month(1, 'de') ); // => Januar
</script>

How it works

function month(month, locale = 'en') {
    let intl = new Intl.DateTimeFormat(locale, { month: 'long' });
    return intl.format( new Date(1970, Number(month) - 1, 1) );
}
month(2, 'de'); // => Februar

More