Skip to content

add tool plugin param type date and date-picker#36163

Open
zyqzyq wants to merge 1 commit into
langgenius:mainfrom
zyqzyq:feat/add_param_data_picker
Open

add tool plugin param type date and date-picker#36163
zyqzyq wants to merge 1 commit into
langgenius:mainfrom
zyqzyq:feat/add_param_data_picker

Conversation

@zyqzyq
Copy link
Copy Markdown

@zyqzyq zyqzyq commented May 14, 2026

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Fixes #36162

Summary

This change adds first-class support for date and date-picker tool/plugin parameter types end to end: schema normalization, backend typing/casting, workflow UI (tool node, variable picker, constant field, trigger form), plugin reasoning configuration, and i18n. Values for date are handled as a single calendar day (string); date-picker represents an optional start/end range serialized as a JSON string/object consistent with backend casting.

Backend

  • Extended CommonParameterType with DATE and DATE_PICKER (api/core/entities/parameter_entities.py).
  • Wired PluginParameterType / ToolParameterType and cast_parameter_value / as_normal_type logic for date and date-picker (api/core/plugin/entities/parameters.py, api/core/tools/entities/tool_entities.py).
  • Added unit coverage for enum values and date-picker casting edge cases (api/tests/unit_tests/core/entities/test_entities_parameter_entities.py).

Frontend

  • Added FormTypeEnum.date and FormTypeEnum.datePicker (declarations.ts) and schema mapping in to-form-schema.ts (including aliases such as datepickerdate-picker).
  • Centralized declarative type matching via toolDeclarativeTypeMatches in form-input-item.helpers.ts (used by form input, variable picker, reasoning config, and input variable list).
  • Tool / trigger forms: form-input-item.tsx renders a native date input for date and ToolDateRangePicker for date-picker (timezone from app context). constant-field.tsx, input-var-list.tsx, tool-form/item.tsx, and trigger-plugin/.../trigger-form/item.tsx updated for labels, tooltips, and picker behavior.
  • Variable reference UX: var-reference-picker.tsx / var-reference-picker.trigger.tsx force constant mode for date-picker and hide the mixed constant/variable type switch where inappropriate.
  • Plugin reasoning panel: reasoning-config-form.tsx + reasoning-config-form.helpers.ts aligned with the same types, filters, and ToolDateRangePicker.
  • New UI pieces: tool-date-range-picker.tsx, tool-date-range-value.ts (parse/stringify range payload); cn from @langgenius/dify-ui/cn for bundler compatibility.
  • i18n: nodes.tool.dateRange.* in web/i18n/en-US/workflow.json and web/i18n/zh-Hans/workflow.json.
  • Tests: form-input-item.helpers.spec.ts, reasoning-config-form.helpers.spec.ts for declarative matching and date / date-picker behavior.

Screenshots

Before After
Tool parameters typed as date / date-picker in provider YAML were not rendered with dedicated controls in the workflow tool node and related pickers. Native date control and start/end range picker for date-picker, with correct variable filtering and constant-only behavior where required.

(Replace the table cells with embedded images if you attach screenshots in the PR.)

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint && make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. javascript Pull requests that update javascript code labels May 14, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update javascript code size:XL This PR changes 500-999 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: tool plugin add date and date-picker type

1 participant