• Resolved mpbaweb

    (@mpbaweb)


    Hi

    Last year you helped me with a calculation where I needed to apply a 50% discount where the submission date fell between 2 dates. This worked perfectly but I realised the year is hard-coded into the formula e.g.

    (function(){
    var d = CDATE(fieldname68, ‘yyyy-mm-dd’);
    if(d < ‘2022-08-01′ || d > ‘2022-09-30′) return 1;
    return 0.5;
    })()

    Is it possible to make this work when the date falls between August and September so the year does not matter? e.g.

    (function(){
    var d = CDATE(fieldname68, ‘mm-dd‘);
    if(d < ‘08-01‘ || d > ‘09-30‘) return 1;
    return 0.5;
    })()

    I love the plugin and your support is unmatched. 5 star

    • This topic was modified 1 year, 8 months ago by mpbaweb.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @mpbaweb

    Thank you very much for using our plugin.

    The solution is simpler. You can implement it as follows:

    (function(){
    var d = CDATE(fieldname68, 'yyyy-mm-dd'), 
        y = YEAR(fieldname68);
    if(d < y+'-08-01' || d > y+'-09-30) return 1;
    return 0.5;
    })()

    Best regards.

    Thread Starter mpbaweb

    (@mpbaweb)

    That’s great. Thank you so much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Logic based on month’ is closed to new replies.