Native date input in template transformation node passes string date value, causing DatePicker error #17130

Closed
opened 2026-02-21 19:31:41 -05:00 by yindo · 0 comments
Owner

Originally created by @JarsirLiu on GitHub (Sep 10, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.8.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When using a native HTML <input type="date"> element in Dify’s frontend template transformation node, it causes a runtime error on the client side. The root cause of this issue lies in the improper handling of the input value type by the DatePicker component.

Specifically, when a user includes the following code in a template:

<form data-format="json">
  <label for="startDate">Start Date of This Week</label>
    <input type="date" name="startDate" value="2025-09-08" />
  <label for="endDate">End Date of This Week</label>
    <input type="date" name="endDate" value="2025-09-14" />
</form>

The native date input generates a date value in string format (e.g., "2025-07-01"). When this value is passed to the DatePicker component, the component expects a Day.js object rather than a string. In the original implementation, when value is a string, there is no proper type checking or conversion, which results in an error when calling Day.js methods.
Image

Image

✔️ Expected Behavior

When it is necessary to have the user confirm information such as time, we hope to preset the time via HTML in the template transformation node, so that the user can confirm or modify it.

For example:

Image

This bug is easy to fix — it can be resolved simply by ensuring that the incoming value, whether it is a string or a Day.js object, is correctly converted to a Day.js object and that the timezone is properly handled. Does the official team have any plans to address it?

Actual Behavior

At runtime, the date in the HTML is not handled correctly, causing the application to crash:
Application error: a client-side exception has occurred while loading localhost (see the browser console for more information).

Image
Originally created by @JarsirLiu on GitHub (Sep 10, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.8.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When using a native HTML `<input type="date">` element in Dify’s frontend template transformation node, it causes a runtime error on the client side. The root cause of this issue lies in the improper handling of the input value type by the **DatePicker** component. Specifically, when a user includes the following code in a template: ``` <form data-format="json"> <label for="startDate">Start Date of This Week</label> <input type="date" name="startDate" value="2025-09-08" /> <label for="endDate">End Date of This Week</label> <input type="date" name="endDate" value="2025-09-14" /> </form> ``` The native date input generates a date value in string format (e.g., `"2025-07-01"`). When this value is passed to the **DatePicker** component, the component expects a **Day.js object** rather than a string. In the original implementation, when `value` is a string, there is no proper type checking or conversion, which results in an error when calling Day.js methods. <img width="2782" height="548" alt="Image" src="https://github.com/user-attachments/assets/a03a5795-f262-4514-b961-abc315b3417d" /> <img width="2726" height="1466" alt="Image" src="https://github.com/user-attachments/assets/9d8ed868-af6c-41b7-80eb-2b05014fbed9" /> ### ✔️ Expected Behavior When it is necessary to have the user confirm information such as time, we hope to preset the time via HTML in the template transformation node, so that the user can confirm or modify it. For example: <img width="1836" height="1129" alt="Image" src="https://github.com/user-attachments/assets/8181b6e8-7645-4cfc-8e31-a04270fdb265" /> This bug is easy to fix — it can be resolved simply by ensuring that the incoming value, whether it is a string or a Day.js object, is correctly converted to a Day.js object and that the timezone is properly handled. Does the official team have any plans to address it? ### ❌ Actual Behavior At runtime, the date in the HTML is not handled correctly, causing the application to crash: Application error: a client-side exception has occurred while loading localhost (see the browser console for more information). <img width="2726" height="1466" alt="Image" src="https://github.com/user-attachments/assets/9d8ed868-af6c-41b7-80eb-2b05014fbed9" />
yindo added the 🐞 bug label 2026-02-21 19:31:41 -05:00
yindo closed this issue 2026-02-21 19:31:41 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#17130