AnsweredAssumed Answered

28 day cycle

Question asked by keith.r on May 24, 2014
Latest reply on May 25, 2014 by keith.r

I’m trying to deconstruct this code (JaveScript?) so I can attempt to replicate in FMP. Its a 28 day cycle which results in:

 

1405 – effective 01 MAY 2014 to 29 MAY 2014

 

So if today is May 24, 2014, the current cycle is 1405 (the 5th 28th day cycle of 2014). The next cycle is: 1406 – effective 29 MAY 2014 to 26 JUN 2014


Code:

 

{{padleft:{{#expr:((({{JULIANDAY|{{CURRENTYEAR}}|{{CURRENTMONTH}}|{{CURRENTDAY}}}}-2454483+364)/364)-0.5 round 0)+7}}|2}}{{padleft:{{#expr:((({{JULIANDAY|{{CURRENTYEAR}}|{{CURRENTMONTH}}|{{CURRENTDAY}}}}-2454483+28)/28)-0.5 round 0)-(((({{JULIANDAY|{{CURRENTYEAR}}|{{CURRENTMONTH}}|{{CURRENTDAY}}}}-2454483+364)/364)-0.5 round 0)-1)*13}}|2}} – effective {{uc:{{#time:d M Y|{{JULIANDAY.TIMESTAMP|{{#expr:(((({{JULIANDAY|{{CURRENTYEAR}}|{{CURRENTMONTH}}|{{CURRENTDAY}}}}-2454483+28)/28)-0.5 round 0)-1)*28+2454483}}}}}}}} to {{uc:{{#time:d M Y|{{JULIANDAY.TIMESTAMP|{{#expr:(((({{JULIANDAY|{{CURRENTYEAR}}|{{CURRENTMONTH}}|{{CURRENTDAY}}}}-2454483+28+(28*1))/28)-0.5 round 0)-1)*28+2454483}}}}}}}}

 

 

So I’ve figure out the equivalents.

JULIANDAY = DayOfYear (not sure on this)

CURRENTYEAR = Year

CURRENTMONTH = Month

CURRENTDAY = Day


These have me scratching my head what to do with. Not sure if it’s part of the html or equation

Padleft

#expr

| <-pipe?


Any insight you can share would be much appreciated. Thanks!


Outcomes