Datepicker is not allowing clearing date

オープン
#1,366 コメント 3 件 リアクション 4 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
react, typescript
領域
frontend

調査の方向性

Datepicker コンポーネントから始め、クリアボタンがどのように onSelectedDateChanged を呼び出すかを追跡します。callback の現在の引数と元の値がどのように復元されるかを確認し、そのうえで issue に記載されたクリア操作の動作を定義し、日付の選択が引き続き通常どおり動作することを検証します。ユーザーが既存の日付をクリアでき、利用側でクリアと日付の選択を区別できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

  • I have searched the Issues to see if this bug has already been reported
  • I have tested the latest version

Summary

Currently, the Datepicker component in Flowbite-React allows users to select a date, but lacks a fully functional clear button that can reset the date to null. The clear button only resets the date to the original value. I propose adding a flag like isClearAction to the onSelectedDateChanged callback function. This flag would be set to true when the clear button is used, allowing developers to explicitly handle the clear action by setting the date to null if desired.

Example implementation:

<Controller
  control={control}
  name="birthday"
  render={({ field: { onChange, value } }) => (
    <Datepicker
      onSelectedDateChanged={(date, isClear) => {
        if (isClear) {
          onChange(null); // Explicitly handle clear action
          return;
        }
        onChange(date); // Handle date change normally
      }}
      placeholder="Please enter date"
      ref={elementRef}
      value={value ? moment(value).format('YYYY-MM-DD') : ''}
    />
  )}
/>

This feature would enable developers to easily implement scenarios where a user might need to completely remove a previously selected date.

Context

In various applications, especially in forms involving date entries like event planning, user registrations, or bookings, having the capability to clear a date completely is crucial. Currently, without this feature, users of our application cannot remove a date once selected; they can only change it. This limitation affects the flexibility and user experience of the application. By implementing this feature, we will provide a more robust and intuitive interaction for users who need to reset their date selections entirely.

主要言語
TypeScript
スター
2.1k
フォーク
502
平均マージ
19時間 16分
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

themesberg/flowbite-react のほかの issue

themesberg/flowbite-react の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。