Remove year from date data type - azure-ad-b2c

I am trying to build a custom sign up policy that will capture a few pieces of data from the user then verify it against a custom API we are building.
One of the pieces of data I need to verify is date of birth however I need to ask for only the Month and Day and NOT the year.
Using the built in datatype of date in the custom policy gives me a date picker but it includes the year.
<ClaimType Id="extension_dateOfBirth">
<DisplayName>Date of Birth</DisplayName>
<DataType>date</DataType>
<AdminHelpText>Your date of birth.</AdminHelpText>
<UserHelpText>Your date of birth.</UserHelpText>
<UserInputType>DateTimeDropdown</UserInputType>
</ClaimType>
Is there anyway to capture just the month and day from the user and NOT the year?

The way I do this is just to have a string with a predicate for "dd/mm" or whatever.

What I ended up doing here is just using two input drop downs capturing ints, one for day and one for month.

Related

Power Automate: Send reminder out 3 months in advance

I have a Microsoft List that has a column called Expiration Date (text in format of MM/DD/YYYY) and Point of Contact (text in format of email#domain.com). How do I create a flow that sends an email out to the Point of Contact 3 months in advance?
My idea was to create a scheduled cloud flow that:
Repeats every day
Looks at every row in specific list
Compares if Expiration Date - 3 Months = Today
If True, send email to Point of Contact
I am currently stuck on step 3 to compare the date. I did Subtract from time to subtract 3 months from Expiration Date but now I do not know how to use this value to compare to today's date.
A better approach is to filter the list by using an OData filter. That will result in a list with all the elements you need.
For doing so, you need to specify the "Filter Query" field (in red):
First type
ExpirationDate eq ''
Then, between the quotes, add an expression, and select the functions addDays and utcNow in the following way:
addDays(utcNow(),92,'MM/dd/yyyy')
Please notice the following:
I'm adding 92 days to get the same day three months in advance for today (today is Oct 18th, so I'm looking for Jan 18th). Maybe adding just 90 days would work for you.
If you just want to add 3 to the month, you would need to get today's date to a variable with utcNow('MM') to get only the month, add 3 to it, and then create the expression accordingly.
I'm sorry the UI is in spanish. I'm from Mexico. But it's the same idea.
In the image, it reads "ExpirationDateText" because that's the way I named the field in my example. In your case, "ExpirationDate" should work.

Is it possible to calculate age-group using Claims Transformations in an Azure B2C Custom Policy?

I have successfully created a custom policy that asks for a user's date-of-birth.
What I would like to do next is tailor the sign-up experience depending on the user's age.
I am hoping that I could do this using claims transformations and preconditions, but looking through the documentation that I have found, I cannot see how to do it. Is it possible?
I have the user's DOB, I think I can get the current date-time (TransformationMethod="GetCurrentDateTime" is mentioned here: https://learn.microsoft.com/en-us/azure/active-directory-b2c/manage-user-access#capture-terms-of-use-agreement), but I can't see how to calculate the difference (for age), or use the age in a precondition.
The only work-around I can think of is to calculate the age (or age-group), via a REST API claim exchange, but I would prefer not to add more complexity to the system.
Thanks all!
I have the user's DOB, I think I can get the current date-time
(TransformationMethod="GetCurrentDateTime" is mentioned here:
https://learn.microsoft.com/en-us/azure/active-directory-b2c/manage-user-access#capture-terms-of-use-agreement),
but I can't see how to calculate the difference (for age), or use the
age in a precondition.
The logic that is used to calculate ageGroup from the user's date of birth:
Try to find the country by the country code in the list. If the country is not found, fall back to Default.
If the MinorConsent node is present in the country element:
a. Calculate the date that the user must have been born on to be
considered an adult. For example, if the current date is March 14,
2015, and MinorConsent is 18, the birth date must be no later than
March 14, 2000.
b. Compare the minimum birth date with the actual birth date. If the
minimum birth date is before the user’s birth date, the calculation
returns Minor as the age group calculation.
If the MinorNoConsentRequired node is present in the country element, repeat steps 2a and 2b using the value from MinorNoConsentRequired. The output of 2b returns MinorNoConsentRequired if the minimum birth date is before the user’s birth date.
If neither calculation returns true, the calculation returns Adult.
What I would like to do next is tailor the sign-up experience
depending on the user's age.
You could try to use age gating to do this.

best way to collect birthdays in google forms

I need to collect birth dates in a Google Form. In my first iteration I chose to format the question as a date, but the form pre-filled the year with 2017, which many users did not notice - ultimately causing yours truly extra work hunting chasing bad data. I took a survey from Google and they made the birth date three separate fields. What's the best way to collect a birth date?
For birthdays (when you are going years back) the best way is to go as an inverted pyramid: First year, then month, lastly day.
UX-wise, for birth dates, it is better to use a <select> for each string (year, month, date) rather than using an <input type="date">

Create own date mappings in API.ai

I want to create a mapping of date ranges and what a user says.
For example:
When a user says "MTD sales for Product A", I want the bot to understand that MTD means current month start to today (Date-Period format). How can I do this?
Also, the agent is able to understand first half of last month (15 day range) but cannot understand "first 15 days of last month". How can I map this statement to a date range so that it learns similar examples for the future?
Maybe you can create an entity for date-period formats with the list of formats you want to support?
Then the selected format could be sent to your custom webhook configured in fullfillment. You would receive this format as a parameter in your backend and could do anything you want with this information.

How to know the current quarter with date?

Is it possible to know the current quarter using Linux command line?
I didn't find a way to do it within the date man page.
The dates corresponding to the start and end of a fiscal quarter vary by country, as well by the nature of the entity doing the fiscal reporting (corporate/personal/government/other...); some companies also have alternate schedules. As such, there is no standard API for this. You will have to get the current month and date and compare it to the appropriate quarter start/end dates for the country and entity of interest. You can find the dates for some countries in wikipedia.
There is now the %q format to show this information.
From the coreutils-8.26 release log from November 30, 2016:
New Features
...
date now accepts the %q format to output the quarter of the year.
And yes it works!
$ date "+%q"
4
$ date "+%Y%q"
20164

Resources