Skip to content

Added a helper method for date normalisation#12

Merged
shubham-thanki-at-sandbox merged 5 commits into
mainfrom
feature/date-util-time-zone
Apr 10, 2026
Merged

Added a helper method for date normalisation#12
shubham-thanki-at-sandbox merged 5 commits into
mainfrom
feature/date-util-time-zone

Conversation

@shubham-thanki-at-sandbox

Copy link
Copy Markdown
Contributor

This pull request refactors the DateUtil class to improve code maintainability and consistency when handling date inputs. The main change is the introduction of a new normalizeDate helper method, which centralizes the logic for converting numeric timestamps to Date objects. This method is now used throughout the class, replacing repeated inline checks.

Refactoring for date normalization:

  • Added a protected static normalizeDate method to DateUtil, which converts a number to a Date object or returns the Date as is. This centralizes and simplifies date normalization logic.
  • Updated all methods in DateUtil that previously checked and converted numeric date arguments inline to use the new normalizeDate method instead, improving readability and reducing code duplication. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Version bump:

  • Incremented the package version from 2.0.5 to 2.0.6 in package.json to reflect these internal improvements.

@shubham-thanki-at-sandbox shubham-thanki-at-sandbox changed the title Refactor date normalization and update version to 2.0.6 Added a helper method for date normalisation Apr 10, 2026
@shubham-thanki-at-sandbox shubham-thanki-at-sandbox merged commit ef0c938 into main Apr 10, 2026
1 check passed
@shubham-thanki-at-sandbox shubham-thanki-at-sandbox deleted the feature/date-util-time-zone branch April 10, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants