Using variable in Date&Time widget

Hi All,
I want to set the default date of my Date&Time widget to current date - 1 year (no time needed). I used a Create Date & Time Range node followed by a Date & Time shift to get the proper date, then a table row to variable node. When I try to use my variable for the default date in my widget, I get an error ‘Can’t parse date: 2019-12-15’.
Can someone help me to get this fixed?
Thanks,
Claire

Hi @Claire,

do the logs provide any further information? I could imagine that the node still expects time information, i.e. your flow variable would look like 2019-12-15T00:00:00

Hi Marten,

Not really. I have this in the log:
2020-12-15 15:06:45,491 : WARN : main : : Node : Date&Time Widget : 0:1846 : Errors loading flow variables into node : Can’t parse date: 2019-12-15

Claire

Hi @Claire and @Marten_Pfannenschmidt,

i’ve just checked it. The issue is the String Variable as far as it is used as source for the Base column (Referece). I assume for the Base Column no string variables are allowed. If it is assigned as variable to the test column with setting as fixed date&time it could be a string and technically works.

In most cases the reference date is a date in the past and therefore it must be of type date. The issue is that for variables only Integer, double and strings types are allowed.

A workaround could be if you assign the Reference date as an additional column and refer to those column.

BR
Hermann

Just tested this, Date&Time Widget node does expect a flow variable value (type string) that contains date+time+timezone information. Just change the configuration of your create Date&Time Range node to create Date&Time with zone and it should work:

2 Likes

Hi Marten,

It works much better thanks, I can set the default value.
But next question: I get now the time and time zone in the display. Is there a way to hide them? Same question for the Date label. I’m just interested by the calendar.

Thanks a lot,
Regards,
Claire
Date_widget

Hi again…,

I got it, I was able to hide the time and time zone just by using ‘Date’ in the type. Now, I would like to know if I can remove the ‘Date’ label.

Thanks,
Claire

You could use CSS editor to hide that label and then use the custom CSS in the Date Widget node via flow variable configuration:
1.

For further reference on the different CSS classes per node: https://docs.knime.com/latest/analytics_platform_css_guide/

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.