OnThisDay.js is a JavaScript library for fetching events on specific dates from Wikipedia. It allows you to retrieve historical events, births, and deaths that occurred on the current or a particular date.
How to use OnThisDay.js:
import { OnThisDay } from 'https://cdn.jsdelivr.net/gh/MarketingPipeline/OnThisDay.js@latest/dist/onthisday.min.js';
// Fetch events, births, and deaths for a specific date
try {
let onDate = await OnThisDay('July 4')
console.log('All Data:', onDate.getAll());
console.log('Births:', onDate.getBirths());
console.log('Deaths:', onDate.getDeaths());
console.log('Events:', onDate.getEvents());
} catch (error) {
console.log(error.message)
}
// Fetch events, births, and deaths that happened on the current date.
try {
let onToday = await OnThisDay()
console.log('All Data:', onToday.getAll());
console.log('Births:', onToday.getBirths());
console.log('Deaths:', onToday.getDeaths());
console.log('Events:', onToday.getEvents());
} catch (error) {
console.log(error.message)
}
Want to improve this? Create a pull request with detailed changes / improvements! If approved you will be added to the list of contributors of this awesome project!
See also the list of contributors who participate in this project.
This library is open-source and available under the MIT License. See the LICENSE file for more details.