hakizimana-fred / OnThisDay.js

A JavaScript library to find out what events happened today or any provided day in history.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OnThisDay.js

Repo Banner for OnThisDay.js - JavaScript Library

Show your support!

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.

Example and usage

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)
}

Contributing GitHub

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.

License GitHub

This library is open-source and available under the MIT License. See the LICENSE file for more details.

About

A JavaScript library to find out what events happened today or any provided day in history.

License:MIT License


Languages

Language:JavaScript 100.0%