Commit 3fd70091 authored by Siltaar's avatar Siltaar
Browse files

Merge branch 'master' of framagit.org:Siltaar/month_nb

parents c8c407f1 3d8a3cbd
= month_nb : get the number of a month from its name
month_nb : get the number of a month from its name
`month_nb.js` is a small utility which knows the corresponding number of a month
name, in 69 https://en.wiktionary.org/wiki/Appendix:Months_of_the_year[languages].
......@@ -13,17 +13,27 @@ name, in 69 https://en.wiktionary.org/wiki/Appendix:Months_of_the_year[languages
The function returns a month number from a given litteral case-insensitive month
name or abbreviation. It returns `undefined` if no corresponding number is found.
It's currently presented as plain JavaScript files. To use it simply includes
the following files in your environnement :
To use it, include the `month_nb.js` file and define a `month_nb_json` variable
containing the `month_nb.json` instantiated object :
```html
<script src="month_nb.js" type="text/javascript"></script>
<script type="text/javascript">
month_nb_json = {};
fetch("month_nb.json").then(r => r.json()).then(json => month_nb_json = json);
</script>
<script src="month_nb.js" type="text/javascript"></script>
```
A working expliciter approach is be :
```html
<script src="month_nb.js" type="text/javascript"></script>
<script type="text/javascript">
fetch("month_nb.json").then(r => r.json()).then(month_nb_json => {
month_nb('août', month_nb_json);
});
</script>
```
== Architecture
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment