Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

SRP_Date( 'AddMonths') for negative numbers

I'm just testing out the v2.1.10 "Fixed bug in SRP_Date where using negative numbers in AddMonths returned wrong results" using v2.1.11.
It seems that subtracting 5 months or more from the current date returns a null result. Eg, SRP_Date( 'AddMonths', date(), -10) returns null. Is this expected?

Cheers, M@

Comments

  • Better - except for the following values, for some reason ;)

    -5,-17,-29,-41,-53,-65,-77,-89,-101,-113,-125,-137,-149,-161,-173,-185,-197,-209,-221,-233,-245,-257,-269,-281,-293,-305,-317,-329,-341,-353,-365,-377,-389,-401,-413,-425,-437,-449,-461,-473,-485,-497,-509,-521,-533,-545,-557,-569,-581,-593,-605,-617,-629,-641,-653,-665,-677,-689,-701,-713,-725,-737,-749,-761,-773,-785,-797,-809,-821,-833,-845,-857,-869,-881,-893,-905,-917,-929,-941,-953,-965,-977,-989

    I've only checked up to -1000, but presumably there's a pattern here.

    Cheers, M@
  • edited May 2021
    Used "LT" instead of "LE", rookie mistake. It's a good thing you're a better tester than me. This one should do the trick.
  • Ah - I see the pattern! -5 (May) then -12 each after that, so something to do with year boundaries :).
    Yes, this version works fine - thanks :)
Sign In or Register to comment.