#Java Spring Framework Date, Date Time
24 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @robust stream! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
you mean when endtime is more than 6 months after starttime?
for example team started today 1/14/2023 (using local date time)
and it should end 6 months from now
and team should become automatically finished
so the finished should only depend on whether endtime is before or after tze current date?
ok
on endtime
yeah, endtime should be compared to the current date, right?
Are you using a getter for finished?
yes for both
What about that: You remove finished but instead of removing the getter, you change it to:
public boolean isFinished(){
return LocalDate.now().isAfter(getEndtime());
}
then you don't store whether it is finished but calculate it on the fly
ooh i like the logic
and if the end time is always 6 months after the start time, you could also do something similar for endtime if you want to
no problem