Last active
April 30, 2020 21:21
-
-
Save FauziFerdiansyah/78b775c70b00521fc99f51c3fa6e7192 to your computer and use it in GitHub Desktop.
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
var dateObj = new Date(); | |
var month = ('0' + (dateObj.getMonth() + 1)).slice(-2); | |
var date = ('0' + dateObj.getDate()).slice(-2); | |
var year = dateObj.getFullYear(); | |
var shortDate = year + '' + month + '' + date; | |
// Replace ./data.json with your JSON feed | |
fetch('https://raw.githubusercontent.com/guangrei/Json-Indonesia-holidays/master/calendar.json') | |
.then(response => response.json()) | |
.then(data => { | |
if(data[shortDate]){ | |
console.log(data[shortDate]['deskripsi']); | |
}else{ | |
console.log('Jangan lupa absen.') | |
} | |
}) | |
.catch((error) => { | |
console.error('Error:', error); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment