Skip to content

[Form] Add input=date_point to DateTimeType, DateType and TimeType #60315

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

Open
wants to merge 1 commit into
base: 7.3
Choose a base branch
from

Conversation

wkania
Copy link
Contributor

@wkania wkania commented May 1, 2025

Q A
Branch? 7.3
Bug fix? no
New feature? yes
Deprecations? no
Issues
License MIT

Based on datetime_immutable.

After DatePointType and DatePointDateType, it would be great to use Forms without needing to transform values into the DatePoint type manually.

use Symfony\Component\Form\Extension\Core\Type\DateType;

$builder->add('from', DateType::class, [
    'input' => 'date_point',
]);

Alternative: Make symfony/clock a hard requirement and refactor the existing DateTimeImmutableToDateTimeTransformer to return a DatePoint instead. This should not introduce any breaking changes.

@wkania wkania requested review from xabbuh and yceruto as code owners May 1, 2025 19:11
@carsonbot carsonbot added this to the 7.3 milestone May 1, 2025
@wkania wkania changed the title [Form] Add to DateTimeType, DateType and TimeType [Form] Add DatePoint to DateTimeType, DateType and TimeType May 1, 2025
@wkania wkania changed the title [Form] Add DatePoint to DateTimeType, DateType and TimeType [Form] Add input=date_point to DateTimeType, DateType and TimeType May 1, 2025
@xabbuh
Copy link
Member

xabbuh commented May 2, 2025

The approach makes sense to me.

@wkania wkania force-pushed the data_point_form branch from 908ad1b to cb58650 Compare May 2, 2025 17:57
@wkania wkania force-pushed the data_point_form branch from cb58650 to 521e9cf Compare May 2, 2025 18:06
@wkania wkania requested a review from yceruto May 2, 2025 18:07
@wkania
Copy link
Contributor Author

wkania commented May 2, 2025

I have added DateTimeType and TimeType.

Copy link
Member

@yceruto yceruto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants