npm.io
1.0.1 • Published 6 years ago

@dipser/wmlang.js

Licence
MIT
Version
1.0.1
Deps
0
Size
9 kB
Vulns
0
Weekly
0

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

Keywords