Skip to content

A robust and versatile date calculator script that provides precise calculations of time intervals between dates.

License

Notifications You must be signed in to change notification settings

felipefacundes/date_difference

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Date Difference

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.

Features

  • 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

Installation

git clone https://github.com/felipefacundes/date_difference
cd date_difference
chmod +x date_difference

Usage

./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.

Integration with shell_utils

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

Technical Details

  • 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

Contributing

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.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Author

Felipe Facundes

Repository

https://github.com/felipefacundes/date_difference

Releases

No releases published

Packages

No packages published

Languages