-
Notifications
You must be signed in to change notification settings - Fork 3
【イベント】イベント新規作成or編集時の日付選択をDatePickerコンポーネントに置き換える #250 #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
イベント作成or 編集時の日付選択の際に、専用のコンポーネントを利用するように修正しました。 これにより、よりブラウザの標準仕様ではなく、専用のUIで日付の選択ができるようになります。 その他、一部修正を行なっています。 以下、修正の概要です。 - Form要素で使える日付選択用のコンポーネント(FormInputDate)を実装 - lib/utilにgetDateTimeRemovedTimezoneを追加 - CommonRegisterFormFieldでinput要素かつ、typeがdateである場合に、今回追加したコンポーネントを使用するように変更 - FormField.tsxにコメントを追加
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
A PR that replaces native date inputs with a custom DatePicker component for event creation/edit forms, adds a utility to normalize dates by removing timezone offsets, and plugs the new component into the form renderer.
- Introduce getDateTimeRemovedTimezone util to strip timezone offsets
- Create FormInputDate component wrapping DatePicker plus a hidden formatted input
- Update FormField to render FormInputDate for
input[type="date"]fields
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| front/src/lib/util/date.ts | Added getDateTimeRemovedTimezone util to normalize dates without timezone offsets |
| front/src/components/organisms/common/form/FormField.tsx | Updated form renderer to use FormInputDate for date inputs |
| front/src/components/molecules/field/FormInputDate.tsx | New date-specific input component using DatePicker and hidden formatted field |
Comments suppressed due to low confidence (2)
front/src/components/molecules/field/FormInputDate.tsx:1
- Add unit tests for
FormInputDateto ensure the date is normalized correctly, the hidden input value is formatted as expected, andonChangeupdates state correctly.
import { DatePicker } from "@/components/molecules/input/DatePicker"
front/src/lib/util/date.ts:185
- [nitpick] The JSDoc for
getDateTimeRemovedTimezonerepeats similar wording for both description and return. Consider clarifying that this function removes the local timezone offset so that the date represents the same local time in UTC.
/**
| */ | ||
| export default function FormInputDate({ name, placeholder, hasError, defaultValue }: Readonly<FormInputDateProps>) { | ||
| // 日付を管理するstate(デフォルト値があればそれを使用し、なければ今日の日付を使用) | ||
| const [date, setDate] = useState<Date>(defaultValue ? new Date(defaultValue) : new Date()) |
Copilot
AI
Jul 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initializing the state with new Date(defaultValue) can lead to inconsistent parsing of a 'YYYY-MM-DD' string across browsers. Consider using getDateTimeRemovedTimezone(new Date(defaultValue)) to normalize the date when a default is provided.
| const [date, setDate] = useState<Date>(defaultValue ? new Date(defaultValue) : new Date()) | |
| const [date, setDate] = useState<Date>(defaultValue ? getDateTimeRemovedTimezone(new Date(defaultValue)) : new Date()) |
今の実装だと、日付を変えない場合にTimeZoneの削除が一回も実行されないことになるので修正
hidden型のinput要素においてプレースホルダーを除外 Co-authored-by: Copilot <[email protected]>
|
@atomisu0312 |
ご無沙汰しております。
イベント作成or 編集時の日付選択の際に、専用のコンポーネントを利用するように修正しました。
これにより、ブラウザの標準仕様ではなく、専用のUIで日付の選択ができるようになります。
その他、一部修正を行なっています。
以下、修正の概要です。
以下、イベント新規作成機能における差分となります。
前:

後:
