Skip to content
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

Add date- and time-related utilities and extensions #83

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

ric15ni
Copy link
Contributor

@ric15ni ric15ni commented Sep 25, 2023

Proposed changes

Add a series of date- and time-related utilities and extensions:

  • constants for several "magic numbers" (ticks per hour, ticks per day, milliseconds per day, etc.);
  • utility methods to get the first and last day in a week or month, either relative to the current date, or as extension methods on both DateTime and DateOnly;
  • extension methods for DateTime to get the last day in a week or month, at the latest possible time (last tick), useful to define inclusive ranges (for example as parameters to a SQL query using a BETWEEN clause).

Checklist of related issues / discussions

There was no time for opening an issue, let alone discussing it. The added code comes from production projects, where it has been copypasted more times than I'll ever admit. 😬

Types of changes

This pull request introduces the following types of changes:

  • Bug fix
  • New feature
  • Test addition / update (no changes to non-test code)
  • Refactor (no changes in public API syntax or semantics)
  • Performance improvement (no changes in public API syntax or semantics)
  • Documentation (docs directory) update
  • Dependency addition / update
  • Changes to the build scripts
  • Changes to CI (workflows, bot / app configurations)
  • Changes to repository files (.gitattributes, .gitignore)
  • Other

Breaking changes

This pull request introduces breaking changes:

  • Yes
  • No

Checklist

  • For all types of changes:
  • For code changes only:
    • The project builds on my machine, via the provided build script, with zero warnings
    • I have added tests that prove my feature works / my fix is effective
    • I have added / modified XML documentation according to changes in code
    • I have checked that all the links I added or modified in XML documentation point to their intended destination
  • For documentation changes (docs directory) only:
    • I have built and tested documentation locally
    • I have checked that all the links I added or modified point to their intended destination

@github-actions github-actions bot added the area:code [issue/PR] affects project code (excluding tests). label Sep 25, 2023
@ric15ni ric15ni changed the title Add date / time related utilities and extensions. Add date- and time-related utilities and extensions. Sep 25, 2023
Copy link
Member

@rdeago rdeago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@rdeago rdeago merged commit dacdc22 into Tenacom:main Sep 25, 2023
5 checks passed
@ric15ni ric15ni deleted the date-time-utilities branch September 25, 2023 14:00
@rdeago rdeago changed the title Add date- and time-related utilities and extensions. Add date- and time-related utilities and extensions Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:code [issue/PR] affects project code (excluding tests).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants