Skip to content

[Cases][Templates] Add DATE_PICKER field control type#260209

Merged
MykhailoKondrat merged 1 commit intoelastic:mainfrom
MykhailoKondrat:feature/add-datepicker-field
Mar 31, 2026
Merged

[Cases][Templates] Add DATE_PICKER field control type#260209
MykhailoKondrat merged 1 commit intoelastic:mainfrom
MykhailoKondrat:feature/add-datepicker-field

Conversation

@MykhailoKondrat
Copy link
Copy Markdown
Contributor

@MykhailoKondrat MykhailoKondrat commented Mar 30, 2026

What & Why

Adds DATE_PICKER as a new field control type in the Templates V2 field definition system. Template authors can now include date fields (with optional time selection and UTC/local timezone) in template YAML definitions. The user action timeline renders date values using the locale-aware date formatter instead of a raw ISO string.

How to Test

  1. Navigate to Cases → Settings → Templates and open a template for editing.
  2. Add a DATE_PICKER field to the YAML definition (e.g. control: DATE_PICKER, type: date). Confirm the live preview renders a date picker input.
  3. Set metadata.show_time: true — confirm a time selector appears. Set metadata.timezone: local — confirm the picker uses local time.
  4. Add validation: required: true to the field, save the template, open a case using that template, and submit without picking a date — confirm the form blocks submission with an error.
  5. Pick a date, save the case, and open the activity timeline — confirm the user action reads "set to " rather than a raw ISO string.

Checklist

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

@MykhailoKondrat MykhailoKondrat requested a review from a team as a code owner March 30, 2026 09:56
@MykhailoKondrat MykhailoKondrat changed the title add datepicker field [Cases][Templates] Add DATE_PICKER field control type Mar 30, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Mar 30, 2026

💔 Build Failed

Failed CI Steps

Metrics [docs]

‼️ ERROR: metrics for d11c3f9 were not reported

History

@MykhailoKondrat MykhailoKondrat added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:Cases Security Solution Cases team Cases: Templates Development of cases templates system Feature - improved case templates labels Mar 30, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-cases (Team:Cases)

@MykhailoKondrat MykhailoKondrat force-pushed the feature/add-datepicker-field branch from d11c3f9 to be0a8c8 Compare March 30, 2026 11:08
Comment on lines +129 to +132
.object({
show_time: z.boolean().optional(),
timezone: z.enum(['utc', 'local']).optional(),
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌🏻

Copy link
Copy Markdown
Contributor

@lgestc lgestc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one nit about sourcing field type

return i18n.SET_TEMPLATE_FIELD_LABEL(getFieldDisplayName(key), String(value));
const displayName = getFieldDisplayName(key);

if (key.endsWith('AsDate') && typeof value === 'string') {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can get exact field type here, based on field definition - no need to guess it based on alias I think

Copy link
Copy Markdown
Contributor Author

@MykhailoKondrat MykhailoKondrat Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have a field definition here - this function is operation over the output of user_actions, not templates entity.
The information about the field we have is limited, and I am not sure we want to to modify user_actions to return more data just to handle this specific case.

  {
    "type": "create_case",
    "payload": {
      "connector": {
        "id": "none",
        "type": ".none",
        "fields": null,
        "name": "none"
      },
      "title": "Example template",
      "tags": [
        "example"
      ],
      "description": "A short description of the template",
      "settings": {
        "syncAlerts": false,
        "extractObservables": false
      },
      "owner": "observability",
      "severity": "low",
      "assignees": [],
      "status": "open",
      "category": "General",
      "customFields": []
    },
    "created_at": "2026-03-31T12:22:20.371Z",
    "created_by": {
      "username": "elastic",
      "full_name": null,
      "email": null,
      "profile_uid": "u_mGBROF_q5bmFCATbLXAcCwKa0k8JvONAwSruelyKA5E_0"
    },
    "owner": "observability",
    "action": "create",
    "comment_id": null,
    "id": "d9a7e2d4-a916-4efd-bea0-efa3a1cbf908",
    "version": "WzY2LDJd"
  },
  **{
    "payload": {
      "extended_fields": {
        "start_date_as_date": "2024-01-18T00:00:00.000Z"
      }
    },
    "type": "extended_fields",
    "created_at": "2026-03-31T12:22:35.342Z",
    "created_by": {
      "username": "elastic",
      "full_name": null,
      "email": null,
      "profile_uid": "u_mGBROF_q5bmFCATbLXAcCwKa0k8JvONAwSruelyKA5E_0"
    },
    "owner": "observability",
    "action": "update",
    "comment_id": null,
    "id": "8a184422-aac2-4c98-a819-9e2bccf0ba16",
    "version": "WzY5LDJd"
  }**
]```

@MykhailoKondrat MykhailoKondrat merged commit a8fb287 into elastic:main Mar 31, 2026
18 checks passed
mbondyra added a commit to mbondyra/kibana that referenced this pull request Mar 31, 2026
…hanges

* commit 'd0e62a657916e84694a93983e513ce9e34e0b635': (27 commits)
  [Agent Builder] Agent overview page design updates (elastic#260468)
  [Inference UI] Add model detail flyout with endpoint management (elastic#260307)
  [Fleet] Update doc links in agent policy settings (elastic#260245)
  [Security Solution] show risk score in new flyout header (elastic#260187)
  Replace deprecated EUI icons in files owned by @elastic/kibana-security (elastic#255636)
  [Cases][Templates] Add DATE_PICKER field control type (elastic#260209)
  [SharedUX] Get spaces callout on each solution nav (elastic#259723)
  [SharedUX] Preserve feature visibility on solution change (elastic#259316)
  [CI] Increase investigations cypress disks to 110G (elastic#260423)
  [Agent Builder] Expose read-only conversations on plugin start contract (elastic#260435)
  [dasboards as code] drop panels with server errors (elastic#260073)
  [One Workflow] Add force-delete (hard delete) option for workflows (elastic#260391)
  [Agent Builder] Fix sidebar error handling error (elastic#260446)
  [Agent Builder] Add attachment origin to Converse API (elastic#259043)
  [Alerting v2] Fix rule results preview chart responsiveness (elastic#260444)
  [Streams] Processing error panel UI improvements (elastic#260028)
  fix flaky test: alert details error page timeout (elastic#260302)
  [Agent Builder] Add attachment origin to Converse API (elastic#259043)
  [One Workflow] Add more unit tests to workflows_extensions plugin (elastic#260384)
  [ResponseOps] Split alerting security_and_spaces group8 FTR config to fix CI timeout (elastic#260029)
  ...
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Apr 1, 2026
## What & Why
Adds `DATE_PICKER` as a new field control type in the Templates V2 field
definition system. Template authors can now include date fields (with
optional time selection and UTC/local timezone) in template YAML
definitions. The user action timeline renders date values using the
locale-aware date formatter instead of a raw ISO string.

## How to Test
1. Navigate to **Cases → Settings → Templates** and open a template for
editing.
2. Add a `DATE_PICKER` field to the YAML definition (e.g. `control:
DATE_PICKER`, `type: date`). Confirm the live preview renders a date
picker input.
3. Set `metadata.show_time: true` — confirm a time selector appears. Set
`metadata.timezone: local` — confirm the picker uses local time.
4. Add `validation: required: true` to the field, save the template,
open a case using that template, and submit without picking a date —
confirm the form blocks submission with an error.
5. Pick a date, save the case, and open the activity timeline — confirm
the user action reads "set <field> to <formatted date>" rather than a
raw ISO string.

## Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [x] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Apr 2, 2026
## What & Why
Adds `DATE_PICKER` as a new field control type in the Templates V2 field
definition system. Template authors can now include date fields (with
optional time selection and UTC/local timezone) in template YAML
definitions. The user action timeline renders date values using the
locale-aware date formatter instead of a raw ISO string.

## How to Test
1. Navigate to **Cases → Settings → Templates** and open a template for
editing.
2. Add a `DATE_PICKER` field to the YAML definition (e.g. `control:
DATE_PICKER`, `type: date`). Confirm the live preview renders a date
picker input.
3. Set `metadata.show_time: true` — confirm a time selector appears. Set
`metadata.timezone: local` — confirm the picker uses local time.
4. Add `validation: required: true` to the field, save the template,
open a case using that template, and submit without picking a date —
confirm the form blocks submission with an error.
5. Pick a date, save the case, and open the activity timeline — confirm
the user action reads "set <field> to <formatted date>" rather than a
raw ISO string.

## Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [x] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Cases: Templates Development of cases templates system Feature - improved case templates release_note:skip Skip the PR/issue when compiling release notes Team:Cases Security Solution Cases team v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants