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 lastMoment getter to Interval #1280

Merged
merged 2 commits into from
Aug 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/interval.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,14 @@ export default class Interval {
get end() {
return this.isValid ? this.e : null;
}

/**
* Returns the last DateTime included in the interval (since end is not part of the interval)
* @type {DateTime}
*/
get lastDateTime() {
return this.isValid ? this.e.minus(1) : null;
}

/**
* Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'.
Expand Down