cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Content validation: check against today's date possible?

olga_wall
Guide

Hi all,

 

I know that it's possible in browser monitors to validate against text, regex, and placeholders such as {email}.

I have a use case where I'd like to validate against today's date (i.e. the date of the execution day). A regex wouldn't be helpful in this case because there is a list of dates and I'd need a content validation of the latest.

Has anyone done something like this before? If yes, how? Or is this impossible to achieve with a synthetic monitor at all?

 

Thanks,

Olga

5 REPLIES 5

HannahM
Dynatrace Leader
Dynatrace Leader

Hi Olga, 

 

yes, date validation and manipulation are both possible in Dynatrace Synthetic. You can use api.date() to get the current date in epoch format. Then you can either convert it or compare it to a list of other epoch dates. 

Hi Hannah,

good to know, thanks!

Just to confirm: api.date() will also work with manually added JS events within browser clickpaths? Because I have only seen this reference only in the documentation section for HTTP monitors

Apologies, you're right. We need to use  Date.now() in the Browser Monitor JavaScript event instead. Good spot. 

girish_dindukur
Newcomer

I have a similar scenario..can you please provide some example on how to resolve this

Sorry, I haven't implemented this use case yet and thus I don't have any examples to share. 
But you can check the documentation on JavaScript events in browser monitors as a starting point: https://www.dynatrace.com/support/help/shortlink/id-brower-clickpath-events#javascript

Featured Posts