WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Fixed value between two dates

[Resolved] Fixed value between two dates

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

    @codepeople

    Hi,

    Suppose your form includes two date fields, start date (called fieldname1) and end date (called fieldname2), the corresponding equation in this case would be:

    (function(){
    var r = abs(fieldname2-fieldname1);
    if( r == 1) return 15;
    if( r == 2) return 27;
    if( r > 2 ) return 5*r;
    })();

    Note: Transform the previous equation with the fields names used in your form.

    Hi,

    Tanks it works !

    After this i just need to add a somme for an option, How its possible to calculate, the result of the function above and other variable.

    Tanks

    Plugin Author codepeople

    @codepeople

    Hi,

    Suppose that your equation includes another field (called fieldname3) that should be added to the value related with the date fields, in this case the equation should be modified like follow:

    (function(){
    var r = abs(fieldname2-fieldname1);
    var n;
    if( r == 1) n = 15;
    if( r == 2) n = 27;
    if( r > 2 ) n = 5*r;

    return n+fieldname3;
    })();

    Note: the previous equation is only a demo, but contains the pattern to create your own equation.

    Wouaw tanks ! amazing plugin, just need to go to pro version !

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Fixed value between two dates’ is closed to new replies.