Skip to main content

DeliveryDate

Provides an interface for selecting a preferred delivery date during checkout. Displays a row of quick-select date tiles for upcoming days, plus an optional "Other date..." tile that opens a modal with a native date picker.

Usage

Basic -- show 3 upcoming weekdays with date picker

import DeliveryDate from '@/components/propeller/DeliveryDate';

<DeliveryDate
onDateSelect={(date) => setDeliveryDate(date)}
/>

Show 5 days including weekends, no custom date picker

<DeliveryDate
showUpcomingDays={5}
skipWeekends={false}
showDatePicker={false}
onDateSelect={(date) => setDeliveryDate(date)}
/>

Custom date formatting and labels

<DeliveryDate
onDateSelect={(date) => setDeliveryDate(date)}
formatDateDisplay={(iso) => {
const d = new Date(iso);
return d.toLocaleDateString('nl-NL', { weekday: 'long', day: 'numeric', month: 'long' });
}}
labels={{
pickDate: 'Kies een andere datum...',
modalTitle: 'Selecteer een leverdatum',
cancel: 'Annuleren',
}}
/>

Inside a checkout form

const [deliveryDate, setDeliveryDate] = useState('');

<form onSubmit={handleCheckout}>
<h2>Choose delivery date</h2>
<DeliveryDate
showUpcomingDays={4}
onDateSelect={(date) => setDeliveryDate(date)}
containerClass="my-4"
/>
<button type="submit" disabled={!deliveryDate}>Continue</button>
</form>

Configuration

Date Selection

PropTypeDefaultDescription
showUpcomingDaysnumber3Number of upcoming days to display as quick-select tiles
skipWeekendsbooleantrueWhether to skip Saturdays and Sundays when generating upcoming dates
showDatePickerbooleantrueShow an "Other date..." tile that opens a modal with a native <input type="date">

Callbacks

PropTypeDefaultDescription
onDateSelect(date: string) => void--Called when a date is selected. Receives the date in ISO format: YYYY-MM-DDT00:00:00Z

Display & Customization

PropTypeDefaultDescription
formatDateDisplay(date: string) => string--Custom function to format dates for display. Receives an ISO string, returns display text. Default format: Wed, Mar 12
labelsRecord<string, string>--Override default label strings. Supported keys: pickDate (default "Other date..."), modalTitle (default "Select a delivery date"), cancel (default "Cancel")
containerClassstring'delivery-date'CSS class applied to the outermost container element

Labels

KeyDefaultDescription
pickDate"Other date..."Text on the custom date picker tile
modalTitle"Select a delivery date"Heading inside the date picker modal
cancel"Cancel"Cancel button text in the modal

Behavior

  • Generates upcoming dates starting from tomorrow (never today).
  • Weekends (Saturday and Sunday) are skipped by default. Set skipWeekends={false} to include them.
  • The quick-select tiles are rendered in a responsive grid: 1 column on mobile, 2 on small screens, up to 4 on medium+ screens.
  • Clicking a tile selects that date, applies a visual highlight (border-secondary + light background), and fires onDateSelect.
  • The "Other date..." tile opens a modal with a native HTML date input. The minimum selectable date is tomorrow.
  • When a custom date is picked, the modal closes automatically and onDateSelect fires with the ISO-formatted date.
  • If a custom date was previously selected, the "Other date..." tile shows the formatted date instead of the placeholder text.
  • Only one date can be selected at a time. Selecting a new date (quick-select or custom) replaces the previous selection.
  • The modal closes when clicking the backdrop area outside the dialog, or by pressing the close (X) button or Cancel button.

SDK Services

This component does not call any SDK services directly. It is a purely presentational date-selection UI. The parent component is responsible for sending the selected date to the backend, typically via the cart or order mutation.

A common integration pattern is to pass the selected ISO date string to a cart update mutation:

mutation CartUpdate($input: CartUpdateInput!) {
cartUpdate(input: $input) {
cart {
cartId
deliveryDate
}
}
}

With variables:

{
"input": {
"cartId": "abc-123",
"deliveryDate": "2026-03-27T00:00:00Z"
}
}

In practice, this is handled through the Propeller SDK's CartService:

import { CartService } from 'propeller-sdk-v2';

const cartService = new CartService(graphqlClient);
await cartService.cartUpdate({
cartId: cart.cartId,
deliveryDate: selectedDate, // ISO string from onDateSelect
});