title: Condiontionalpannel Multiple Conditions and Calculating Age (R Shiny Dashboard)
body: <p>I was wondering if I could get your help.</p>
  
  <p><strong>Background:</strong> I am building a shiny app (see here: <a href="https://camh-nds.shinyapps.io/STOPDataQuality/" rel="nofollow noreferrer">https://camh-nds.shinyapps.io/STOPDataQuality/</a>) to help with data quality control</p>
  
  <p><strong>PROBLEM #1</strong></p>
  
  <p>In the "SOR" tab, Step 1: the goal is to notify the user if <code>DateSurveyed</code> = <code>WorkshopDate</code> and display the appropriate message if it correct or not. This works fine.</p>
  
  <p>For Step 2: a valid <code>QuitDate</code> falls between this range:
  <code>DateSurveyed</code>>= <code>QuitDate</code> &lt;= <code>DateSurveyed</code> + days(30)</p>
  
  <p>If this condition is satisfied display the following text: "The Quit Date entered is valid. </p>
  
  <p>If the condition is not satisfied I would like to display the corrected quit dates.</p>
  
  <ul>
  <li>The correct quit dates is based on:</li>
  </ul>
  
  <p>i) if <code>QuitDate</code> &lt; <code>DateSurveyed</code>, then display the following text: "Correct Quit Date is [value of <code>DateSurveyed</code> here]</p>
  
  <p>ii) if <code>QuitDate</code> > <code>DateSurveyed</code> + days (30) then display the following text: "Correct Quit Date is [value of <code>DateSurveyed + days(30)</code> here].</p>
  
  <p>Here is the ui code</p>
  
  <pre><code>dashboardBody(
              tabItems(  
                #Data Quality for Stop on The Road (SOR)
                tabItem(tabName="SOR",
                #Checking if Date Surveyed= Workshop Date         
                        h3("Step 1- check to see if Date Surveyed = Workshop Date"),
                        HTML ('&lt;/br&gt;'),
                #Entering Date Surveyed  
                        dateInput('date',
                          label='Date Surveyed: yyyy-mm-dd'),
                #Entering Workshop Date    
                     dateInput('date2',
                         label='Workshop Date: yyyy-mm-dd'),
                #If DateSurveyed=WorkShopDate display this message
                conditionalPanel("input.date==input.date2",
                                 textOutput("EqualDates")),
                #If DateSurveyed!=WorkshopDate display this message
                conditionalPanel ("input.date!=input.date2",
                                 textOutput("ErrorDates")),
                HTML ('&lt;/br&gt;'),
                HTML ('&lt;/br&gt;'),
                HTML ('&lt;/br&gt;'),
                #Checking to see if a Valid Quit Date has been entered
                h3("Step 2- check to see if subject has entered a valid quit date"),
                #Description to user what is a Valid Quit date 
                h5("* Note: Quit Dates can start as early as Date Surveyed or be set on 30 days after the Date Surveyed"),
                HTML ('&lt;/br&gt;'),
                #Entering Quit Dates
                dateInput('date3',
                          label='Quit Date: yyyy-mm-dd'),
  
                #Valid Quit Dates: if QuitDate&gt;=DateSurveyed AND QuitDate&lt;=DateSurveyed + days(30); 
                #Then display message
                conditionalPanel("input.date3&gt;=input.date &amp;&amp; input.date3&lt;=input.date + days(30)",
                #HELP! Conditional statement is not working!!!                 
                                 textOutput("ValidQuitDate")),
  
                #Incorrect Quit Dates: if QuitDate&lt;DateSurveyed OR QuitDate&gt;DateSurveyed + days(30); 
                #Then display message 
                conditionalPanel("input.date3&lt;input.date || input.date3&gt;input.date + days(30)",
                #HELP! Conditional statement is not working!!!                 
                                 textOutput("InvalidQuitDate"))
                ),
  </code></pre>
  
  <p>server:</p>
  
  <pre><code>library(lubridate)
  library(shiny)
  library(shinydashboard)
  
  # Define server logic required to draw a histogram
  shinyServer(function(input, output) {
  
  #SOR Date Surveyed   
  output$dateText  &lt;- renderText({
  paste("input$date is", as.character(input$date))
  })
  
  #SOR Work Shop Date  
  output$dateText2 &lt;- renderText({
  paste("input$date2 is", as.character(input$date2))
  })
  
  #SOR: if DateSurveyed=WorkshopDate then display this message  
   output$EqualDates&lt;- renderText({
   "**CORRECT** Dates are Equal!!!"
   })
  #SOR: if DateSurveyed!= WorkshopDate then display this message   
   output$ErrorDates&lt;- renderText({
   "**ERROR** Dates are NOT Equal"
  })
  #SOR: if QuitDate=DateSurveyed OR QuitDate&lt;= DateSurveyed+ days(30) then 
  display this message 
  output$ValidQuitDate&lt;- renderText({
   "You have entered a Valid Quit Date"
  }) 
  
  #SOR: if QuitDate&lt;DateSurveyed OR QuitDate&gt;DateSurveyed+ days(30) then 
  display this message
  output$InvalidQuitDate&lt;- renderText({
   "**ERROR** Incorrect Quit Date Entered"
  }) 
  
  
  
  
  })
  </code></pre>
  
  <p><strong>Problem 2: Calculating Age</strong></p>
  
  <p>In the Age Tab, I simply want to calculate the age using the following formula:
  Age=(Date Sureyed-DateOfBirth)/365. I would like to display the answer as for example: 19 years old and 3 months if possible. </p>
  
  <p>Here is the link the my Github repo: <a href="https://github.com/AhmadMobin/STOPDQ" rel="nofollow noreferrer">https://github.com/AhmadMobin/STOPDQ</a></p>
  
  <p>Appreciate the help I can get!</p>
  
  <p>Thanks in advance </p>