UltiRequiem / leap-year-api

:date: An API to know if a year is leap or not.

Home Page:https://leap.deno.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Leap Year API

Code Coverage

A leap year is a calendar year that contains an additional day added to keep the calendar year synchronized with the astronomical year or seasonal year.

Endpoints

GET /

https://leap.deno.dev

Returns if the current year is leap.

Currently(2022) it returns πŸ‘‡

{ "result": false }

GET /:year

https://leap.deno.dev/2004

Returns if ${YEAR} is a leap year.

{ "result": true }

GET /range/:start/:end

https://leap.deno.dev/range/1/20

A list with all the leap years from year ${START} to ${END}.

{ "result": [4, 8, 12, 16, 20] }

Usage

You can see usage examples (in different languages) in examples/ and in the tests.

Related

  • leap_year: Contains the core logic of this API.

Includes a CLI Tool if you are interested.

Changelog

  • Jul 21, 2021: Start, using Express and CommonJS πŸŽ‰

The logic to calculate if the year was a leap year was in the router.

  • Dec 23, 2021: Move to ESM πŸš€

The logic where moved to an NPM package, check-leap-year.

  • Jan 31, 2022: Add usage example in different languages πŸ‘€

Especially Go, Ruby and Python.

  • 24 Mar, 2022: Moved to Deno, using Oak 🐿

The NPM package was deprecated in favor of @ultirequiem/leap-year, which is Deno first but works on Node.js and the browser too πŸ˜†

Support

Open an Issue, I will check it a soon as possible πŸ‘€

If you want to hurry me up a bit send me a tweet πŸ˜†

Consider supporting me on Patreon if you like my work πŸ™

Don't forget to start the repo ⭐

Licence

Licensed under the MIT License πŸ“„

About

:date: An API to know if a year is leap or not.

https://leap.deno.dev

License:MIT License


Languages

Language:TypeScript 100.0%