A robust and versatile date calculator script that provides precise calculations of time intervals between dates. This tool is part of the comprehensive shell_utils framework, one of the largest collections of scripts and utilities designed to enhance user experience in shell environments.
-
Multilingual Support: Comprehensive internationalization with support for multiple languages:
- English, Portuguese, French, Spanish, German
- Hebrew, Arabic, Russian, Romanian
- Chinese, Korean Each language includes complete error messages and user prompts.
-
Precise Calculations:
- Accurate computation of differences in years, months, and days
- Proper handling of edge cases around month endings and year transitions
- Intelligent management of varying month lengths
- Ensures accuracy across date boundaries
-
Input Validation:
- Accepts flexible date formats (YYYY/MM/DD or YYYY-MM-DD)
- Validates year format (must be 4 digits)
- Validates month range (1-12)
- Validates day range (1-31)
- Verifies logical date order
-
Professional Error Handling:
- Comprehensive input validation
- Clear, language-specific error messages
- Proper exit codes for system integration
- User-friendly usage instructions
git clone https://github.com/felipefacundes/date_difference
cd date_difference
chmod +x date_difference
./date_difference <start_date> <end_date>
Example:
./date_difference 2023/01/01 2024/12/31
The dates must be in the format YYYY/MM/DD or YYYY-MM-DD.
This script is a component of the shell_utils framework, which provides an extensive collection of utilities for shell environments. To access the complete framework:
git clone https://github.com/felipefacundes/shell_utils
- Written in Bash
- GPLv3 License
- Follows shell scripting best practices
- Modular design with separate functions for validation and calculation
- Well-documented code with clear comments
- Suitable for both personal use and system integration
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Felipe Facundes