• Resolved strifer

    (@strifer)


    Hi Edgar,
    I have been using your Smart Forms on another page for quite some time, now I am trying the new All In Ones.

    I am struggling to find any way to work with dates as it was previously. I am trying to figure out amount of days between two dates but I can’t find any working formula. The same goes for the time which I need to use in some conditional formating. How can I get to that, please?

    At the moment it seems this plugin can do a lot less than previously, that doesn’t make much sense to me, so I am probably just stoopid 🙂

    Thank you!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author EDGARROJAS

    (@edgarrojas)

    Hello!

    Sorry for that, this plugin is very new and not all the features of smart forms have been added yet. Could you tell me which features you are looking to use so i work in adding them? Jut the days between two dates? also could you detail me what you mean with “The same goes for the time”, do you want to make an operation against the time as well?

    Thread Starter strifer

    (@strifer)

    Hi Edgar,
    thank you for such a swift response! 🙂

    I am working on a form for equipment rental. Therefore there is a checklist with items and a Date Range.
    The calculation is simply the Price of items times days where the first day isn’t counted if rented after 14.00 and the last day isn’t counted if returned before 14.00.

    With one exception, for example if rented on day 1 at 17h and returned the following one at 10h, then it should count 1 day. But that is an easy fix with one If – If the result of “days” is 0, then make it 1. 🙂

    Thank you!!!

    Plugin Author EDGARROJAS

    (@edgarrojas)

    ok so if i understand correctly you first need to get the days between two dates and also the time of a datepicker so you can substract days if they meet a condition?

    Thread Starter strifer

    (@strifer)

    That would be the best. Regarding the time I think I only need the value of start time and end time and I can compare this value to a condition, what do you think?

    But I can work with the difference between days only and put the time info to infobox only. eg. “This price is only valid if you rent after 14 and return before 14”. I don’t know how complicated this is for you 🙂

    Plugin Author EDGARROJAS

    (@edgarrojas)

    Got it, last question, are you using two date fields or a date range field?

    Thread Starter strifer

    (@strifer)

    Right now I have them both in my form at the moment as I was trying to get either of them working. I like the Date range field better, but it doesn’t really matter.

    Thread Starter strifer

    (@strifer)

    I have two follow-up questions, I hope you don’t mind 🙂

    1. How can I translate names of days in the week and months? I have found your Spanish .po so I reduced it to these things and translated, renaming it to end with cs_CZ.po . But that doesn’t roll 🙂

    2. I have seen in the source code there is a string with First day of the week, which makes me think I can set it somewhere. But I couldn’t find it.

    Thank you!

    Thread Starter strifer

    (@strifer)

    About the first one, I figured it out partially. For anyone else looking, if you use Loco translate:

    Using Loco translate select “All in one forms” in Plugins, go to Configuration and select rednaowooextraproduct.mo as a template instead of the one preselected. Then I could add the Czech language and do the translation with no errors.

    Not sure it will show on the front-end yet however.

    • This reply was modified 1 year, 8 months ago by strifer.
    Plugin Author EDGARROJAS

    (@edgarrojas)

    Ok please update the plugin, i added a few functions that will let you do that, i think the formula that you need is this one:

    if([RNF "10" RNF].GetEndDate()==null||[RNF "10" RNF].GetStartDate()==null)
    return 0;
    
    days=RNDateDiff([RNF "10" RNF].GetStartDate(),[RNF "10" RNF].GetEndDate(),true)
    
    days=RNFloor(days)
    if(RNDatePart([RNF "10" RNF].GetStartDate(),"H")<14)
      days=days-1
    
    if(RNDatePart([RNF "10" RNF].GetEndDate(),"H")>14)
      days=days-1
    
    return days;

    Change “10” for the id of your date range field. Also you might need to clear your temporary internet files to be sure your browser is using the latest files of everything.

    Regards!

    Thread Starter strifer

    (@strifer)

    Hi Edgar,
    thank you! I will try as soon as I can download the update, there is only 1.2.39 available at the moment.

    EDIT: It works like a charm! Thank you!

    • This reply was modified 1 year, 8 months ago by strifer.
    Thread Starter strifer

    (@strifer)

    Before the new version comes live, could you please check the First day in week and the Translation location please? I have translated the months/days as stated before but it doesn’t work in the front-end unfortunately 🙁

    Plugin Author EDGARROJAS

    (@edgarrojas)

    Oh the update was already release before reading this sorry. To keep things organized could you create a different thread for the other issue please?

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Formulas with dates’ is closed to new replies.