1.0.1 • Published 4 years ago

@dipser/wmlang.js v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

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