its-thursday
Version:
A simple utility to check if a given date is Thursday
131 lines (89 loc) • 2.95 kB
Markdown
# its-thursday
A simple utility to check if a given date is Thursday.
## Installation
```bash
npm install its-thursday
```
## Usage
```javascript
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 in `Y-m-d` format (e.g., `2023-12-07`)
#### Returns
- `boolean`: `true` if the date is Thursday, `false` otherwise
#### Throws
- `Error`: If the date string is not in the correct format (`Y-m-d`)
- `Error`: If the provided date is invalid
## Examples
```javascript
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
```bash
npm test
```
### Watch Mode
```bash
npm run test:watch
```
### Coverage
```bash
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](DEPLOYMENT.md).
For branch protection setup, see [BRANCH_PROTECTION.md](BRANCH_PROTECTION.md).
For 2FA setup with npm, see [NPM_2FA_SETUP.md](NPM_2FA_SETUP.md).
For GitHub release issues, see [GITHUB_RELEASE_FIX.md](GITHUB_RELEASE_FIX.md).
### Publishing a New Version
1. Update version:
```bash
npm version patch # or minor/major
```
2. Push to main:
```bash
git push origin main
```
3. GitHub Actions will automatically publish to npm! 🎉
## 🔧 Contributing
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Ensure all tests pass
6. Submit a pull request
## 📊 Project Status



## License
MIT