Giter Club home page Giter Club logo

leap-year's Introduction

leap-year

Code Coverage Deno Docs

Check if a year is a leap year, that's a calendar year that contains an additional day added to keep the calendar year synchronized with the astronomical year or seasonal year.

Usage

import { isLeapYear } from "https://deno.land/x/leap_year/mod.ts";

isLeapYear(2014); //=> false
isLeapYear(2016); //=> true
isLeapYear("6 October 2006 00:07:00 GMT"); //=> false
isLeapYear("2000"); //=> false
isLeapYear(new Date(2016, 1, 1)); //=> true
isLeapYear("13 December 400 00:07:00 GMT", true); //=> { year: 400, result: true }
import { isLeapYear } from "@ultirequiem/leap-year";

You can use any CDN 🔥

Eg. ESMSkyPack / script tagJSDelivr.

The API is the same on all this platforms.

API

Autogenerated Documentation 🚀

CLI Tool

Was done mainly as usage example.

Install

  • Node.js 🦍
npm install -g @ultirequiem/leap-year
  • Deno 🦕
deno install https://deno.land/x/leap_year/leap-year.ts

Usage

leap-year "13 October 2020 00:07:00 GMT" 400 345
true
true
false

Or with the verbose flag 👇

leap-year "13 October 2020 00:07:00 GMT" 400 345 --verbose # -v
2020 is a leap year.
400 is a leap year.
345 is not a leap year.

Related

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 star the repo ⭐

Versioning

We use Semantic Versioning. For the versions available, see the tags 🏷️

Licence

Licensed under the MIT License 📄

leap-year's People

Contributors

foxieflakey avatar ultirequiem avatar web-flow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

leap-year's Issues

Not detecting all cases

(await import('https://deno.land/x/leap_year/mod.ts')).isLeapYear('01-01-2000') // returns false

should be true.

The problem is the ?? operator! The code on the left has to be nullish not falsey to be evaluated! Should be replaced by ||

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.