Import#
import { Field } from '@dnb/eufemia/extensions/forms'render(<Field.InstallmentDay />)
Description#
Field.InstallmentDay is a dropdown-based field for selecting which day of the month a recurring monthly payment is made, such as a loan installment or standing order.
By default it shows days 1–28 plus a "Last day of the month" option. Days 29–31 are excluded because they do not exist in every month. The "Last day of the month" option serves customers paid at month end. Use the days prop to override the available days, and showLastDay={false} to remove the last day option.
The dropdown lists the available days as plain numbers, while the selected value is shown as a readable ordinal phrase (for example "15th day of the month").
The value type is number | 'last'.
There is a corresponding Value.InstallmentDay component.
Relevant links#
Demos#
Default#
Days 1–28 with "Last day of the month".
<Field.InstallmentDay onChange={(value) => console.log('onChange', value)} />
With a value#
<Field.InstallmentDay value={15} />
Constrained days#
Use the days prop to limit available options to specific days.
<Field.InstallmentDay days={[1, 5, 10, 15, 20, 25]} onChange={(value) => console.log('onChange', value)} />
Without last day of the month#
Use showLastDay={false} to hide the "Last day of the month" option.
<Field.InstallmentDay showLastDay={false} onChange={(value) => console.log('onChange', value)} />
Constrained days without last day#
Combine days and showLastDay={false} for a compact selection without the "Last day of the month" option.
<Field.InstallmentDay days={[1, 5, 10, 15, 20, 25]} showLastDay={false} onChange={(value) => console.log('onChange', value)} />
Required#
<Form.Handler onSubmit={(data) => console.log('onSubmit', data)}> <Field.InstallmentDay path="/installmentDay" required /> <Form.SubmitButton top="small" /> </Form.Handler>
Disabled#
<Field.InstallmentDay value={10} disabled />
With help#
<Field.InstallmentDay help={{ title: 'What is an installment day?', content: 'The installment day is the day of the month when the payment is deducted from your account.', }} />
Transform to a backend format#
Internally the field works with clean values – a number (1–28) or 'last'. When the backend expects a different wire format, such as a fixed two-digit day ('01'–'28') with a sentinel for the last day of the month, use transformOut to convert the value at the API boundary. The converted value is what gets stored in the form data and passed to onChange and onSubmit. Use transformIn to convert incoming data (for example initial values) back to the field's internal value so it displays correctly.
// The field works with clean values internally: a number (1–28) // or 'last'. At the API boundary we convert to the wire format the // backend expects – a fixed two-digit day ('01'–'28') and a sentinel // for the last day of the month. const transformOut = (internal) => { if (internal === 'last') { return 'last-day' } if (typeof internal === 'number') { return String(internal).padStart(2, '0') } } // Convert the backend format back to the field's internal value // so it displays correctly. const transformIn = (external) => { if (external === 'last-day') { return 'last' } if (external != null && external !== '') { return Number(external) } } render( <Form.Handler defaultData={{ installmentDay: '01', }} onSubmit={(data) => console.log('onSubmit', data)} > <Field.InstallmentDay path="/installmentDay" transformIn={transformIn} transformOut={transformOut} onChange={(value) => console.log('onChange', value)} /> <Form.SubmitButton top="small" /> <Tools.Log top="small" /> </Form.Handler> )