Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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 1 month ago
JSON representation
🎉 Micro library for checking if it's April 1st
- Host: GitHub
- URL: https://github.com/himynameisdave/is-april-fools
- Owner: himynameisdave
- License: mit
- Created: 2019-03-26T20:47:55.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T16:15:47.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T18:09:24.213Z (2 months ago)
- Topics: april-fools, date, fun, micro-library, utility
- Language: TypeScript
- Homepage:
- Size: 2.82 MB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
---
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-foolsyarn 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._