Created
March 16, 2020 22:28
-
-
Save rhcarlosweb/f3c1879b9233d158618d1bf0f1dbff55 to your computer and use it in GitHub Desktop.
Date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Dates | |
*/ | |
const days = 3; | |
const date = new Date(); | |
const last = new Date(date.getTime() + (days * 24 * 60 * 60 * 1000)); | |
const day = last.getDate(); | |
const month = last.getMonth() + 1; | |
const year = last.getFullYear(); | |
const dayEl = document.querySelector('.day'); | |
const monthEl = document.querySelector('.month'); | |
const yearEl = document.querySelector('.year'); | |
dayEl.textContent = day; | |
monthEl.textContent = last.toLocaleString('default', { month: 'long' }); | |
yearEl.textContent = year; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment