Menu

#339 Calendar getDate With Negative Duration

v1.0_(example)
closed
Jon Iles
5
2026-03-12
2019-12-02
Wes Lund
No

I'm having problems with negative lags (leads). I'm gathering predecessors and attempting to calculate the appropriate "lag date." So, for example, if I have a F-S link with a 3 day lag, I'd take the predecessors finish, and add 3 days of lag.

To do this, I tried using Calendar.getDate. The problem I have is that getDate fails to take negative durations into account. Am I missing something? Is there a simpler/better way to apply a Duration to a Date? Otherwise, I would think we could modify getDate to work with negative durations?

Discussion

  • Wes Lund

    Wes Lund - 2019-12-02

    To clarify, I'm getting negative lags (leads) and cannot get the correct date from a given date and negative duration. The positive duration lags are calculating fine.

     
  • Wes Lund

    Wes Lund - 2020-01-02
    1. For negative duration calculations, I found Calendar.getStartDate, which will do just fine. One simply has to multiply the duration by -1.
    2. Calendar.getStartDate makes the assumption that if 7 days in a row are non-working, that the calendar is defunct. However, there can be 7+ day non-working day periods (think long Christmas breaks). For me, I changed the 7 day check to 365 days, not sure if you want the modification, but I'll include it.

    Think that wraps it up. Excuse my ignorance.

     

    Last edit: Wes Lund 2020-01-02
  • Jon Iles

    Jon Iles - 2026-03-12
    • status: open --> closed
     
  • Jon Iles

    Jon Iles - 2026-03-12

    Just tidying up old issues, but to confirm thatthe getDate method in the most recent MPXJ releases should handle both positive and negative values correctly.

     

Log in to post a comment.

Monday.com Logo