DOM Calendar: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 8: | Line 8: | ||
**month in French | **month in French | ||
The function toLocalDateString takes an ''options'' object. You can set: | The function toLocalDateString takes an ''options'' object. You can set: | ||
<pre class=usr> | <pre class=usr> |
Revision as of 21:31, 1 January 2022
1) Display dates as specified
- For today's date show
- day of the week in English
- month in English
- day of the week in French
- month in French
The function toLocalDateString takes an options object. You can set:
Input
xxxxxxxxxx
let today = new Date();
document.body.innerHTML = `
${today.toLocaleDateString('en',{weekday:'long'})} <br>
${today.toLocaleDateString('en',{weekday:'short'})} <br>
`;
Output
let today = new Date(); document.body.innerHTML = ` ${today.toLocaleDateString('en',{weekday:'long'})} <br> ${today.toLocaleDateString('en',{weekday:'short'})} <br> `;
let today = new Date(); document.body.innerHTML = ` ${today.toLocaleDateString('en',{weekday:'long'})} <br> ${today.toLocaleDateString('en',{month:'long'})} <br> ${today.toLocaleDateString('fr',{weekday:'long'})} <br> ${today.toLocaleDateString('fr',{month:'long'})} <br> `;