Skip to content

adjusting_sub but for subtracting a Time #740

@weisbrja

Description

@weisbrja

Hi,

I wanted to calculate the duration until the next time that a certain time of day, let's say 12:34 will take place.

I achieved this using the following code:

(Time::MIDNIGHT + (time - now.time())) - Time::MIDNIGHT

where now is the current OffsetDateTime.

However, this could be achieved instead by simply using the existing adjusting_sub, but sadly this method is not public and I wonder why.

Would it be possible to expose adjusting_sub?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-coreArea: anything not otherwise coveredC-feature-requestCategory: a new feature (not already implemented)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions