Last active
August 20, 2020 02:10
-
-
Save teddy-dev/13d0ae692e86b500504c00e28edcfb01 to your computer and use it in GitHub Desktop.
Wallpaper Engine: Display 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
'use strict'; | |
export function update(value) { | |
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; | |
let time = new Date(); | |
return `${months[time.getMonth()]} ${getOrdinalNum(time.getDate())}, ${time.getFullYear()}`; | |
} | |
// public domain | |
function getOrdinalNum(n) { | |
return n + (n > 0 ? ['th', 'st', 'nd', 'rd'][(n > 3 && n < 21) || n % 10 > 3 ? 0 : n % 10] : ''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment