Dialogflow is accepting wrong date - dialogflow-es

Whenever I enter 37th June as an input it doesn't give error rather it considers the date as 30th June. What I want to do is to create an error prompt whenever 37th June is entered.
I am using #sys.date on a very simple intent which does nothing but accepts date parameter.

If you are using dialogflow and the nodejs fulfillment you could include moment and do some date validation quickly on your own:
moment(dateUserEnteredHere).isValid();

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.

Dialogflow - Force to detect the format [Date][Number] as Date & Time

I am developing a bot using Dialogflow and I ask my user for the date and time.
I have 2 entities that are #sys.date and #sys.time
They might reply like "Monday 4pm". Sometimes they just reply "Monday 4". What I expect is it will extract Monday is sys.date and 4 is sys.time. But it is looking for the next Monday 4th and only extracts #sys.date which is Mon 4th, #sys.time is empty.
How can I force Dialogflow to detect that the number 4 is the time, not the number of date?
I would appreciate any help, thanks!
If you set both of the parameters/entities as "required" you can add a prompt to the user for the information. This will allow them to enter the data separately so the bot doesn't confuse the 2 together. It would go something like this:
bot: "What is the date?"
customer: "Monday"
bot: "What time?"
customer: "4PM"
Here's an example

Dialogflow obtaining wrong dates for prebuilt date entities

Is there a way to change how Dialogflow automatically calculates the date meant by a text identified as a pre-built entity like "sys.date" or "sys.date-period"?
Or, is there a way to create your own entity for dates, and specify how it determines the specific day?
Depending on the day of the week, texts like "on Friday" are actually interpreted as the closest Friday to come in the future, instead of the most recent Friday that has already passed.
If you are using #sys.date entity then you can set the value as date.recent. It will always try to convert the phrase into most recent date.
For example, if you say on monday, it will give you date of recent monday.
Note that the date.recent option is available only for #sys.date not for #sys.date-time or #sys.date-period.
EDIT:
You need to select $date.recent from the options available
As you can see in the example screenshot below, tuesday is converted to most recent tuesday rather than upcoming tuesday.
Hope it helps.

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.

Wrong Date in SuiteScript

I want to get today's date in SuiteScript, when I type var tDate = new Date(); it shows me yesterday's date while debugging. I checked settings, there I couldn't see anything wrongly.
I am editing to this question. Most confusing thing is sometimes new Date () shows correct Date without any changes. No idea why it's acting like this. I added result of 'new Date()' as a picture right below.
In the first picture I captured on 1st of February, that shows me 31st of January which is wrong
In the second picture I captured today, that shows me today's date which is correct.
new Date() will give you the current timestamp according to the timezone of whatever system is running the code. In your browser console, new Date will give you the current timestamp in local time; in a server-side script, new Date will give you the current timestamp according to the timezone of your NetSuite data center.
How are you running this code, and what timezone are you yourself in?

Resources