Date comparison for validation

39 Views Asked by At

good afternoon!

I would like to know how I can be creating a code that expires within a time, using getDate and time.

For example, having an input field, where I check if a token exists, and compare the dates to check if it is active within the period.

I made an input field to validate an access code. However, I couldn't think of how to check/compare two dates.

The idea would be for me to set the start date and end date for using that token.

new InitialDate: DD/MM/YY
new EndDate: DD/MM/YY

<code>function ...
{
  if(inputCode.text == "CodeValidation")
  {
     if(InitialDate > EndDate) return trace("expired code");
     nextFrame();
     // Válido
  }
  else
  {
     // Invalid code.
  }
}</code>
0

There are 0 best solutions below