Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/himynameisdave/is-april-fools

🎉 Micro library for checking if it's April 1st
https://github.com/himynameisdave/is-april-fools

april-fools date fun micro-library utility

Last synced: about 3 hours ago
JSON representation

🎉 Micro library for checking if it's April 1st

Awesome Lists containing this project

README

        


is-april-fools


🎉 Micro library to check if it is April 1st.




Travis Badge


Coverage Status


Bundle size (minified)





---

Simple utility which will return `true` if the current date is April 1st. This allows your app/program/script/system to do something on April fools (such as conditionally showing some April fools joke UI).

### Installation

This package is available on NPM, and you can install it with `npm` or `yarn`:

```
npm install is-april-fools

yarn add is-april-fools
```

Add the `-S` flag if you want to save it to the `"dependencies"` section of your `package.json`.

**Browser/UMD**

If you want to just import this library directly in the browser, you can add the following script tag:

```html

```

This will expose a `isAprilFools` function in the global scope.

### Usage

```js
import isAprilFools from 'is-april-fools';

if (isAprilFools()) {
console.log('🎉 Happy April Fools!');
} else {
console.log('😞 Just another boring day...');
}
```

#### Note

This package uses the current date from the machine it is running on, meaning if this is running on a server or in a lambda somewhere, you may get unexpected results or some weird edge cases.

### Contributing

Feel free to [file an issue](https://github.com/himynameisdave/is-april-fools/issues/new) or open a pull request.

---

_👌 Built by [Dave Lunny](http://himynameisdave.com) in the wonderful year 2019._