Skip to content

feat(ui-select,ui-date-time-input): rework DateTimeInput and replace DateInput v1 with DateInput v2 in DateTimeInput#2518

Open
ToMESSKa wants to merge 1 commit intomasterfrom
INSTUI-4791-time-date-input-rework-multi-version
Open

feat(ui-select,ui-date-time-input): rework DateTimeInput and replace DateInput v1 with DateInput v2 in DateTimeInput#2518
ToMESSKa wants to merge 1 commit intomasterfrom
INSTUI-4791-time-date-input-rework-multi-version

Conversation

@ToMESSKa
Copy link
Copy Markdown
Contributor

@ToMESSKa ToMESSKa commented Apr 16, 2026

BREAKING CHANGE: renderWeekdayLabels prop removed and calendarIcon is a new required prop

INSTUI-4991

ISSUE:

  • DateTimeInput needs to be migrated to the new theming system and use DateInput v2 under the hood

TEST PLAN:

  • check if the component works the same as before in v1
  • check if the components and the examples work in v2 (especially the dark theme)
  • check if all necessary the imports are renamed to latest in v2 and v1 files use the right imports
  • check if the test files are removed from the v1
  • check if the right imports are used in exports/b.ts and exports/a.ts
  • check if the package.json uses the correct versioning
  • check if the renamed or removed tokes are documented in the upgrade guide (if there's any)
  • check if the index.ts files use withStyle instead of withStyleLegacy in v2
  • check if the v2 component uses all the tokens (if there is any)
  • check if all the old icons were replace with the new ones in the index, test and README files (if there's any)
  • check if commit message contains the breaking change comment
  • check if the NewComponentTypes are used in WithStyleProps in props.ts
  • check if the components behaves the same after DateTimeInput v2 was implemented under the hood

@ToMESSKa ToMESSKa force-pushed the INSTUI-4791-time-date-input-rework-multi-version branch from 7167d25 to b06d123 Compare April 16, 2026 09:55
@ToMESSKa ToMESSKa changed the title Inst UI 4791 time date input rework multi version feat(ui-select,ui-date-time-input): rework DateTimeInput and replace DateInput v1 with DateInput v2 in DateTimeInput Apr 16, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 16, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://instructure.design/pr-preview/pr-2518/

Built to branch gh-pages at 2026-04-16 13:27 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Comment on lines -425 to -427
const { isOptionContentAppliedToInput, size = 'medium' } = this.props
const iconSize = selectSizeToIconSize[size]
const checkIcon =
Copy link
Copy Markdown
Contributor Author

@ToMESSKa ToMESSKa Apr 16, 2026

Choose a reason for hiding this comment

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

Unfortunately in my Select rework, some draft code was left in about implementing a check icon on selected items (since then we aggreed not to implement that), so I reverted these here.

@ToMESSKa ToMESSKa self-assigned this Apr 16, 2026
@ToMESSKa ToMESSKa force-pushed the INSTUI-4791-time-date-input-rework-multi-version branch from b06d123 to 4fae7f8 Compare April 16, 2026 11:58
…DateInput v1 with DateInput v2 in DateTimeInput

BREAKING CHANGE: renderWeekdayLabels` prop removed

`calendarIcon` is a new required prop

INSTUI-4791
@ToMESSKa ToMESSKa force-pushed the INSTUI-4791-time-date-input-rework-multi-version branch from 4fae7f8 to a84f237 Compare April 16, 2026 13:22
cy.wrap(onChange)
.should('have.been.called')
.then((spy) => {
const selectedDateId: string = spy.lastCall.args[1]
Copy link
Copy Markdown
Contributor Author

@ToMESSKa ToMESSKa Apr 16, 2026

Choose a reason for hiding this comment

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

In DateInput v2 no id is set on day buttons, so I get the ISO date from the onChange spy.

cy.get('input[id^="TextInput_"]').as('dateInput')
cy.get('body').should('contain', errorMsg)
cy.get('@dateInput').clear().type(`05/18/2017{enter}`)
cy.get('@dateInput').clear().type(`05/18/2017`).blur()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

DateInput v1 had an Enter key handler. In v2 there's no such handler, so the .blur() is used.

@ToMESSKa ToMESSKa requested review from balzss and matyasf April 16, 2026 14:44
@matyasf matyasf requested review from git-nandor and removed request for matyasf April 20, 2026 08:53
| Removed prop | Replacement |
| --------------------- | -------------------------------- |
| `renderWeekdayLabels` | Built in — no replacement needed |

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.

It might be better to use V12ChangelogTable here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@git-nandor V12ChangelogTable is only useful for theme variable changes, but not prop and API changes, so I think I'll leave it as it is

dateRenderLabel="Date"
timeRenderLabel="Time"
invalidDateTimeMessage="Invalid date!"
calendarIcon="Open calendar" prevMonthLabel="Previous month" nextMonthLabel="Next month"
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.

The example code would look better on the documentation page if these were broken into new lines.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@git-nandor Thanks, I fixed these

@git-nandor
Copy link
Copy Markdown
Contributor

The commit message doesn't include the breaking prop changes.
Could you please ask Matyi or Balázs about this?

Overall, it looks good to me! I only have a few minor observations, which I've left in the comments.

I found some slight differences between v11.6 and v11.7, but these seem to be specific to the v2 sub-components that DateTimeInput now uses:

  • The calendar no longer opens when clicking the input and you can only navigate between days using the Tab key.
  • The hover state lacks contrast, and disabled days are not visually distinct enough.
  • The form field no longer gets a border when an invalid date is entered.

@ToMESSKa ToMESSKa requested review from adamlobler April 21, 2026 08:52
@ToMESSKa
Copy link
Copy Markdown
Contributor Author

The commit message doesn't include the breaking prop changes. Could you please ask Matyi or Balázs about this?

Overall, it looks good to me! I only have a few minor observations, which I've left in the comments.

I found some slight differences between v11.6 and v11.7, but these seem to be specific to the v2 sub-components that DateTimeInput now uses:

  • The calendar no longer opens when clicking the input and you can only navigate between days using the Tab key.
  • The hover state lacks contrast, and disabled days are not visually distinct enough.
  • The form field no longer gets a border when an invalid date is entered.

@git-nandor the commit message includes the prop changes a84f237

  • the first difference is due to different API between DateInput v1 and v2
  • the second difference: @adamlobler can you please take a look at these when you review the component please?
  • the third difference is due to different API between FormField v1 and v2

@ToMESSKa ToMESSKa requested a review from git-nandor April 21, 2026 09:21
Copy link
Copy Markdown
Contributor

@balzss balzss left a comment

Choose a reason for hiding this comment

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

overall great work, left some comments about making the api more similar to DateInput


import { Component, SyntheticEvent } from 'react'
import { Locale, DateTime, ApplyLocaleContext } from '@instructure/ui-i18n'
import type { Moment } from '@instructure/ui-i18n'
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 should not use moment at all

*/

import { Component, SyntheticEvent } from 'react'
import { Locale, DateTime, ApplyLocaleContext } from '@instructure/ui-i18n'
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 should not use DateTime at all since it's just a moment wrapper

onRequestValidateDate={this.handleDateValidated}
onBlur={(e) => this.handleBlur(e)}
inputRef={dateInputRef}
placeholder={datePlaceholder ?? ''}
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.

this should be just placeholder={datePlaceholder} because DateInput accepts null as a placeholder an uses it's internal placeholder

locale={locale}
timezone={timezone}
disabledDates={disabledDates}
dateFormat={{
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.

instead of providing this premade formatter and parser, let's allow the users to pass their own or just rely on the one provided by DateInput by default (so dateFormat={props.dateFormat})

import type { Moment } from '@instructure/ui-i18n'
import type { Renderable } from '@instructure/shared-types'

type DateTimeInputProps = {
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 should make the api of DateTimeInput more similar to DateInput, e.g. instead of separate prevMonthLabel and nextMonthLabel props, just use screenreaderlabel={...

* If omitted, it will use 'LL' which is a localized date with full month,
* e.g. "August 6, 2014"
**/
dateFormat?: 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.

this prop should be replaced with the dateFormat type accepted by DateInput

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants