cancel
Showing results for 
Search instead for 
Did you mean: 

Date Issue in Pipeline Parameter

amit_saroha
New Contributor III

Hi All,

I have a requirement to pass date in YYYY-MM-DD format and I am using the expression “Date.now().toLocaleDateString()” but I have the below issue.

image

When I use it in pipeline parameter “Effective_Date” then use _Effective_Date in the pipeline it fails but when I use it directly it works. When I pass something hardcoded in the pipeline parameter it also works e.g. 2022-01-01

Could you suggest what is happening here and what is needed to get it fixed?

Below is not working

image

Below is working

image

1 ACCEPTED SOLUTION

When you need to run the pipeline with earlier dates, is it going to be a manual configuration and run?

You can simply configure the BatchParameterD1 like this:

_Effective_Date == "" ? Date.now().toLocaleDateString() : _Effective_Date

That way, if the parameter is not empty, it will be taken into consideration, if it is, than the current date will be generated.

View solution in original post

8 REPLIES 8

Tell us more on the use case. You have situation where sometimes the date should be current timestamp and sometimes just a date?

If yes, what is the condition?

You can pass an enhanced expression like :
CONDITION ? Date.now() : '2022-11-20'

and wrap this in eval() in the snap itself.

Hello @bojanvelevski,

Sometimes we may have to run the pipeline with old dates due to any issue in our server, network or third-party outages hence I need to pass a date like 2022-11-20, but generally it will be today’s date so I have to use the expression. We don’t care about timestamp only the date in format YYYY-MM-DD.

Also, please help me little more on what you explained in above reply. I am using it as below as of now -
image

When you need to run the pipeline with earlier dates, is it going to be a manual configuration and run?

You can simply configure the BatchParameterD1 like this:

_Effective_Date == "" ? Date.now().toLocaleDateString() : _Effective_Date

That way, if the parameter is not empty, it will be taken into consideration, if it is, than the current date will be generated.

amit_saroha
New Contributor III

Hi @bojanvelevski, yes, it will be a manual run. I tried the expression you have suggested but it didn’t work. Could you suggest what is wrong what I have done.

image

image

image