Skip to content

Custom labels support for (Start) and (End) suffixes in range mode with time input #6280

@romancavry

Description

@romancavry

Describe the bug
When using selectsRange together with showTimeInput the library automatically appends (Start) and (End) strings to the timeInputLabel. Currently, these strings are hardcoded in English and cannot be localized or customized via props. This breaks the user experience for non-English applications.

To Reproduce
Steps to reproduce the behavior:

  1. Set up date picker with selectsRange and showTimeInput
  2. Here you go

Expected behavior
I would like to have new props to customize or translate these suffixes. For example:

  • timeInputStartLabel: a string or function to override the default (Start).
  • timeInputEndLabel: a string or function to override the default (End).

Alternatively, providing a way to pass a custom render function for the entire time caption would be even better:

https://github.com/Hacker0x01/react-datepicker/blob/main/src/calendar.tsx#L1215

Screenshots
Image

  • Version 9.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions