2

I had a look at the below Date transforms documented but couldnt find one which converts datetime to string. How would you achieve this in the custom policy?

https://learn.microsoft.com/en-us/azure/active-directory-b2c/date-transformations

Reason is AssertDateTimeIsGreaterThan takes input claims as string type. I want to pass currentDateTime to this transform! However as the currentDateTime is of type datetime, it fails!

Regards, Dipesh

1 Answers1

2

You can use https://learn.microsoft.com/en-us/azure/active-directory-b2c/date-transformations#datetimecomparison

Then assert the Boolean https://learn.microsoft.com/en-us/azure/active-directory-b2c/boolean-transformations#assertbooleanclaimisequaltovalue

This allows you to work with dateTime and Boolean to perform the comparison and assertion.

Jas Suri - MSFT
  • 10,605
  • 2
  • 10
  • 20
  • 3
    Neat @JasSuri. This is a common question that I get. It would be useful to have two Transform methods - DateTime to string and vice versa. I have one customer that passes a date in the query string so I have to transform it using a REST API. – rbrayb Mar 23 '21 at 01:48
  • 1
    Thats great Jas! Thanks and that will do for now but really need transforms for DT to string and vice versa as pointed out by @rbrayb! – Dipesh Avlani Mar 24 '21 at 10:32