---
title: Migrate to the Polaris date field component
description: >-
  Learn how to migrate the DateField component to Polaris web components in
  checkout and customer account UI extensions.
source_url:
  html: >-
    https://shopify.dev/docs/apps/build/checkout/migrate-to-web-components/date-field
  md: >-
    https://shopify.dev/docs/apps/build/checkout/migrate-to-web-components/date-field.md
---

# Migrate to the Polaris date field component

The Polaris date field component provides a text input with a calendar picker for selecting dates. It replaces the previous [`DateField`](https://shopify.dev/docs/api/checkout-ui-extensions/2025-07/ui-components/forms/datefield) component and is available as [`<s-date-field>`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/date-field) in API versions 2025-10 and newer.

***

## Updated properties

The following properties are different in the Polaris date field component.

### readonly

The previous `DateField` `readonly` prop is now called [`readOnly`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/date-field#properties-propertydetail-readonly) (camelCase).

### year​Month

The previous `DateField` `yearMonth` prop is now called [`view`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/date-field#properties-propertydetail-view). It takes a `YYYY-MM` string instead of a `{year, month}` object.

### default​Year​Month

The previous `DateField` `defaultYearMonth` prop is now called [`defaultView`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/date-field#properties-propertydetail-defaultview). It takes a `YYYY-MM` string.

### disabled

The previous `disabled` prop behavior has changed. Setting `disabled` to `true` still disables the entire field. For disabling specific dates or days, use the new [`disallow`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/date-field#properties-propertydetail-disallow) and [`disallowDays`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/date-field#properties-propertydetail-disallowdays) props.

| Previous pattern | New pattern | Migration notes |
| - | - | - |
| `disabled={true}` | `disabled` | No change needed. |
| `disabled={['2024-12-25', '2024-12-26']}` | `disallow="2024-12-25,2024-12-26"` | Specific dates use comma-separated string in `disallow`. |
| `disabled={['Sunday', 'Saturday']}` | `disallowDays="sunday,saturday"` | Days of week use `disallowDays`. |
| `disabled={[{start: '2024-12-01', end: '2024-12-10'}]}` | `disallow="2024-12-01--2024-12-10"` | Date ranges use double-dash separator. |

## Migrating disabled dates

##### Latest (Preact)

```tsx
import '@shopify/ui-extensions/preact';
import {render} from 'preact';

export default function extension() {
  render(<Extension />, document.body);
}

function Extension() {
  return (
    <s-date-field
      label="Select delivery date"
      defaultValue="2024-12-15"
      disallowDays="saturday,sunday"
    />
  );
}
```

##### Pre-Polaris (2025-07)

```tsx
import {
  reactExtension,
  DateField,
} from '@shopify/ui-extensions-react/checkout';

export default reactExtension(
  'purchase.checkout.block.render',
  () => <Extension />,
);

function Extension() {
  return (
    <DateField
      label="Select delivery date"
      value="2024-12-15"
      disabled={['Saturday', 'Sunday']}
    />
  );
}
```

### on​Year​Month​Change

The previous `onYearMonthChange` prop is now called [`onViewChange`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/date-field#events-propertydetail-viewchange).

## Migrating onYearMonthChange to onViewChange

##### Latest (Preact)

```tsx
import '@shopify/ui-extensions/preact';
import {render} from 'preact';

export default function extension() {
  render(<Extension />, document.body);
}

function Extension() {
  return (
    <s-date-field
      label="Select date"
      defaultValue="2024-12-15"
      view="2024-12"
      onViewChange={(event) => console.log('View changed', event)}
    />
  );
}
```

##### Pre-Polaris (2025-07)

```tsx
import {
  reactExtension,
  DateField,
} from '@shopify/ui-extensions-react/checkout';

export default reactExtension(
  'purchase.checkout.block.render',
  () => <Extension />,
);

function Extension() {
  return (
    <DateField
      label="Select date"
      value="2024-12-15"
      yearMonth={{year: 2024, month: 12}}
      onYearMonthChange={({year, month}) =>
        console.log('View changed', year, month)
      }
    />
  );
}
```

***

## Removed properties

The following properties aren't supported:

* `placeholder` — no longer supported, use `label` instead.

***

## New properties

The Polaris date field component introduces the following new properties:

| New prop | Type | Description |
| - | - | - |
| [`allow`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/date-field#properties-propertydetail-allow) | `string` | Comma-separated list of allowed dates (whitelist). |
| [`allowDays`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/date-field#properties-propertydetail-allowdays) | `string` | Comma-separated list of allowed days of the week. |
| [`disallow`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/date-field#properties-propertydetail-disallow) | `string` | Comma-separated list of disallowed dates. |
| [`disallowDays`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/date-field#properties-propertydetail-disallowdays) | `string` | Comma-separated list of disallowed days of the week. |
| [`required`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/date-field#properties-propertydetail-required) | `boolean` | Whether the field is required. |
| [`autocomplete`](https://shopify.dev/docs/api/checkout-ui-extensions/latest/web-components/forms/date-field#properties-propertydetail-autocomplete) | `string` | Autocomplete attribute for the input. |

***
