its-thursday
v1.1.1
Published
A simple utility to check if a given date is Thursday
Downloads
6
Maintainers
Readme
its-thursday
A simple utility to check if a given date is Thursday.
Installation
npm install its-thursdayUsage
const itsThursday = require('its-thursday');
// Check if today is Thursday
console.log(itsThursday()); // true or false
// Check if a specific date is Thursday
console.log(itsThursday('2023-12-07')); // true (December 7, 2023 was a Thursday)
console.log(itsThursday('2023-12-08')); // false (December 8, 2023 was a Friday)API
itsThursday([dateString])
Returns true if the given date (or current date if no date is provided) is Thursday, false otherwise.
Parameters
dateString(optional): A date string inY-m-dformat (e.g.,2023-12-07)
Returns
boolean:trueif the date is Thursday,falseotherwise
Throws
Error: If the date string is not in the correct format (Y-m-d)Error: If the provided date is invalid
Examples
const itsThursday = require('its-thursday');
// Check current date
if (itsThursday()) {
console.log('Today is Thursday!');
}
// Check specific dates
console.log(itsThursday('2024-01-04')); // true - January 4, 2024 was a Thursday
console.log(itsThursday('2024-02-29')); // true - February 29, 2024 was a Thursday
console.log(itsThursday('2024-03-01')); // false - March 1, 2024 was a Friday
// Error handling
try {
itsThursday('invalid-date');
} catch (error) {
console.error(error.message); // "Date must be in Y-m-d format (e.g., 2023-12-07)"
}Development
Running Tests
npm testWatch Mode
npm run test:watchCoverage
npm run test:coverage🚀 Deployment
This package uses GitHub Actions for automated deployment:
- CI: Runs tests on every push and pull request
- Auto-publish: Publishes to npm on merge to main (if version changed)
- Manual release: Workflow for manual version bumping and publishing
- Branch protection: Blocks publishing until CI passes
For detailed deployment instructions, see DEPLOYMENT.md. For branch protection setup, see BRANCH_PROTECTION.md. For 2FA setup with npm, see NPM_2FA_SETUP.md. For GitHub release issues, see GITHUB_RELEASE_FIX.md.
Publishing a New Version
Update version:
npm version patch # or minor/majorPush to main:
git push origin mainGitHub Actions will automatically publish to npm! 🎉
🔧 Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
📊 Project Status
License
MIT
