Skip to content

Instantly share code, notes, and snippets.

@FauziFerdiansyah
Last active April 30, 2020 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FauziFerdiansyah/78b775c70b00521fc99f51c3fa6e7192 to your computer and use it in GitHub Desktop.
Save FauziFerdiansyah/78b775c70b00521fc99f51c3fa6e7192 to your computer and use it in GitHub Desktop.
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