Year not included after using datepicker in form

When I use the date-picker to fill in a form field about data/time, everything seems normal, but in the submitted data, the year is always missing and is displayed with ‘yyy’ (not 4, but 3), so the result is for example 05/04/yyy.

Is there a way I can fix/avoid this? It was not crucial for my app before, but I now need it and I can’t get it to work. Recreated the flow, created new flows, etc. Always the same result.

Information on my n8n setup

  • n8n version: 1.85.4 (but I have this already for months)
  • Database: SQLite
  • Running n8n via: Docker, self hosted
  • Operating system: Ubuntu

hi,

In the explanation of the form settings, it is mentioned that the date formatting is dependent on what is configured in the local browser.

Can you please verify that.

reg,

1 Like

Thanks @jcuypers!

Good point. After your remark, I tested it in Edge in Windows, Chrome in Windows and Ubuntu, Mobile Chrome, Mobile Edge and Firefox in Windows and in Ubuntu, all with the same results. Their date settings are not browser dependent, but set by the OS. I have chosen different settings in my tests, but they do not influence the results.

And what I just saw, is that even when I fill the dates in by hand, the same effect applies, so it’s not determined by using the date picker pop-up, but just the field itself.

I can’t seem to find out what causes this. Very open to suggestions!

Anyone?

Am I the only one who has this?

Not sure if this is related, but could you check your environment variable to see if you’ve set GENERIC_TIMEZONE correctly?

Also, does this node work on your instance?

Thanks for your support @mohamed3nan ! Very much appreciated.

Yes, the time/date node works. If I ask for the current date/time I do receive the correct response.

If I use my form input for a date and then in the next step extract the year with the time/date node then I do get an error (which isa not surprising since the input is alike 01/01/yyy.

NodeOperationError: Invalid date format at ExecuteContext.parseDate (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/DateTime/V2/GenericFunctions.js:46:19) at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/DateTime/V2/DateTimeV2.node.js:189:69) at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:681:50) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:913:62 at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:1246:20

Is that getting us somewhere…?

what is the output of the form exactly, can you share it

try this:

Here you see (in Dutch) the form asking for the birth date and date of death. For the first one I filled in 1940 and the second one 2025.

The result for both is that they show as ‘yyy’.

Thanks!

1 Like

Please just use this node as it is in new workflow and screenshot the output to just know where the issue exists exactly, sounds like the date picker for now…

1 Like

Yes, this works indeed! Great!

I’m not sure if I understand now where the issue is, but it feels like you have that more clear :wink:

Now check your Form node version

Maybe the issue is there!

Nope, that seems to be the same:

Then the issue is most likely with your form inputs.

If you can share the Form node, we can try them on our end to see if the issue is general or specific to your inputs…

I’m rebuilding it now: I noticed that the output format in my erroneous from different is from the one that you sent (dd/mm/yyyy) vs (yyyy-MM-DD).

I’m not sure yet what the impact of that is, but the form I’m building now seems to have the latter format and that works correctly… No idea how the original form outputs in another format…

1 Like

Hi, Maybe you copy-pasted or imported from a template?

Reg,
J.

I have rebuilt the complete form now, and now it works. Earlier I copied the node in new flows, but I guess I copied - whatever error is in there - with it.

@jcuypers I’m working on this flow for months now, so I don’t remember if I copied it as a flow at the start, but it’s very well possible and a likely explanation; I did do that sometimes. I guess then the node has embedded another date format somewhere and that went wrong.

Your help is very much appreciated; I would have not solved this myself. Thank you @mohamed3nan !

2 Likes

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