Date validation

Certified Senior Developer

I know this may sound little trivial but I couldn't figure out the logic.

I want a button should be enabled before 5 calendar days from the last date of the month to the first 3 calendar days of next month.

Example from if it's Aug, then it should enable on 26 Aug and stay enabled until 3 Sept.

Any help appreciated.

  Discussion posts and replies are publicly visible

Parents
  • Try this.  Since today is Aug 3, it will be enabled, toggle the commenting on lines 2 and 3 to see how it would act tomorrow (disabled):

    a!localVariables(
      local!date: today(),
      /*local!date: today()+1,*/
      local!daysInMonth: daysinmonth(month(local!date),year(local!date)),
      local!day: day(local!date),
      local!dayDisabledStart: 3,
      local!dayDisabledEnd: local!daysInMonth-5,
      {
        a!buttonArrayLayout(
          align: "START",
          buttons: {
            a!buttonWidget(
              label: "Button",
              disabled: not(
                or(
                  local!day<=local!dayDisabledStart,
                  local!day>=local!dayDisabledEnd,
                )
              )
            )
          }
        )
      }
    )

Reply
  • Try this.  Since today is Aug 3, it will be enabled, toggle the commenting on lines 2 and 3 to see how it would act tomorrow (disabled):

    a!localVariables(
      local!date: today(),
      /*local!date: today()+1,*/
      local!daysInMonth: daysinmonth(month(local!date),year(local!date)),
      local!day: day(local!date),
      local!dayDisabledStart: 3,
      local!dayDisabledEnd: local!daysInMonth-5,
      {
        a!buttonArrayLayout(
          align: "START",
          buttons: {
            a!buttonWidget(
              label: "Button",
              disabled: not(
                or(
                  local!day<=local!dayDisabledStart,
                  local!day>=local!dayDisabledEnd,
                )
              )
            )
          }
        )
      }
    )

Children