Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Rule to hide fields when an invalid date is manually entered

Good afternoon!

Sounds simple but I've hit a roadblock. I'm looking for a simple rule for field definition that would hide the rest of a form if the a date field was manually entered incorrectly. 

For example, I'm using the default formatting of (MMM dd, yyyy) so calendar picked dates should work without issue, however, if someone were to type in "01/01/2020" or "qwerty" I'd want the rule to kick in, hide the form and pop up an error info field. Is there a quick and easy way to do this? 

1 answer

1 accepted

You can validate your date, and it's timestamp property in particular

As the date that cannot be parsed usually is set to January 1st 1970 at midnight GMT (Greenwich Mean Time) 

So, you can check if it is larger than that or not (which is 0 timestamp)

Something like this: http://recordit.co/YtTD6AG48G 

Alex

This is great! Works well, but what if a user types in a number, like "1" or "123"? Since the date field is numeric, the timestamp logic doesn't appear to catch just a random number. Is there a workaround to prevent that?

You can make it validate agains some other value than 0

For example, the date should be not before January 1 2021

Checking that it is larger than 1609459200000

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you