-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor and document Persian date handling #27
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Updated `using` directive to include `System.Globalization`. Reformatted `namespace` declaration. Added comprehensive XML documentation to `PersianDateShamsi` class and its methods. Refactored methods to handle `DateTimeOffset` and `DateTime` inputs separately. Added new methods for Shamsi date handling. Improved readability and maintainability of `ToShamsi.cs`, `DateTest.cs`, and `ToShamsiTest.cs` files with reorganized code and added XML comments. Enhanced test coverage for `DateTimeOffset` and null values.
Introduced the `ToGregorian` class in `ToGregorian.cs` to convert Persian (Shamsi) dates to Gregorian dates. This class includes methods to get the Gregorian year, month, day, date string, day name, and to convert a range of Shamsi dates to Gregorian dates. Added a new test class `ToGregorianTest` in `ToGregorianTest.cs` to provide unit tests for the `ToGregorian` class. This includes tests for methods like `GetGregorianYear`, `ToGregorianDate`, `GetGregorianMonth`, `GetGregorianDay`, `GetGregorianDateString`, `GetGregorianDayName`, `GetDayNameFromPersianCharacter`, `ConvertRangeToGregorian`, and `GetFirstDayOfShamsiMonth`. Added the `StringUtil` class in `StringUtil.cs` to provide utility methods for string operations. This includes methods to convert iOS keyboard and Arabic characters to Persian characters, check if a string contains Persian characters, reverse a string, and convert a string to title case.
The README.md file has been significantly updated to improve clarity, structure, and content. Key changes include: - Updated title and description for better readability. - Added badges for NuGet version, downloads, and build status. - Introduced a new "Features" section. - Added "Installation" instructions for NuGet. - Expanded usage examples with more detailed code snippets. - Added a "Version History" section. - Included guidelines for contributing. - Specified the MIT License. - Added a support section for issue reporting. - Enhanced "Getting Started" instructions. - Removed outdated and redundant sections.
Updated PersianDateShamsi package version from 1.0.6 to 1.0.7 in PersianDate.csproj. Enhanced README.md with example outputs for various methods: - GetShamsiMonthName, GetShamsiDayString, GetShamsiDayName, GetShamsiDayShortName - Extension methods: ToShamsiDate, ToShortShamsiDate, ToLongShamsiDate - Gregorian conversion methods: GetGregorianYear, ToGregorianDate, GetGregorianMonth, GetGregorianDay Updated version history in README.md to include version 1.0.7, noting support for DateTimeOffset in ToGregorian class and updates to PersianDateShamsi.cs and ToShamsi.cs.
Introduced an MIT License to the project, granting permissions for use, copy, modification, merging, publishing, distribution, sublicensing, and selling of the software. The license includes a 2024 copyright notice attributed to Hootan Hemmati and specifies that the software is provided "as is" without any warranty, limiting the liability of the authors.
Updated CD.yml to enhance CI/CD: - Trigger on tags matching `v*.*.*` and `pull_request`. - Updated `actions/checkout` to `v4`. - Added `build` job for macOS. - Modified `create_nuget` and `run_test` jobs to depend on `build`. - Changed `deploy` and `create_github_release` to trigger on tag pushes. - Simplified `create_github_release` job. Updated PersianDate.csproj: - Reformatted `Description`. - Corrected `PackageProjectUrl`. - Updated `Version` to `1.7.0`. - Added `VersionPrefix` and `VersionSuffix`. Fixed syntax in global.json.
hootanht
added a commit
that referenced
this pull request
Oct 3, 2024
Merge pull request #27 from hootanht/develop
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Classification
New feature and documentation enhancement.
PR Summary
This PR introduces new functionality for date conversion between Persian (Shamsi) and Gregorian calendars, adds string utility methods, and enhances documentation.
PersianDateShamsi.cs
: Added methods forDateTimeOffset
, refactored for readability, and improved error handling.ToGregorian.cs
: Introduced a new class for converting Shamsi dates to Gregorian dates.StringUtil.cs
: Added a new static class with utility methods for string operations.DateTest.cs
andToGregorianTest.cs
: Refactored and added new unit tests.README.md
: Significantly updated for clarity, added installation instructions, usage examples, and version history.