Skip to content

[Form][Date(Time)Type] Use a custom string date format #29883

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

Closed
fancyweb opened this issue Jan 14, 2019 · 3 comments
Closed

[Form][Date(Time)Type] Use a custom string date format #29883

fancyweb opened this issue Jan 14, 2019 · 3 comments

Comments

@fancyweb
Copy link
Contributor

Currently there is no way to use a custom string date format (cf

new DateTimeToStringTransformer($options['model_timezone'], $options['model_timezone'])
).

This is a problem if you already have data in another format than the default one. It becomes impossible to use these form types without a data migration.

Should we add a "string_format" option ? @xabbuh

@stof
Copy link
Member

stof commented Jan 14, 2019

The data transformer already supports this setting. Exposing it in the form type for people using the string input makes sense to me.
What do you think @HeahDude ?

@xabbuh
Copy link
Member

xabbuh commented Jan 14, 2019

Adding a new option like input_format to be used in conjunction with the input being a string sounds reasonable to me.

symfony-splitter pushed a commit to symfony/form that referenced this issue Feb 20, 2019
…eType (fancyweb)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[Form] Add input_format option to DateType and DateTimeType

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony/symfony#29883
| License       | MIT
| Doc PR        | symfony/symfony-docs#10882

Add a new option to specify the date format when using the `string` input type.

Commits
-------

c8240a0423 [Form] Add input_format option to DateType and DateTimeType
xabbuh added a commit that referenced this issue Feb 20, 2019
…eType (fancyweb)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[Form] Add input_format option to DateType and DateTimeType

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #29883
| License       | MIT
| Doc PR        | symfony/symfony-docs#10882

Add a new option to specify the date format when using the `string` input type.

Commits
-------

c8240a0 [Form] Add input_format option to DateType and DateTimeType
@xabbuh
Copy link
Member

xabbuh commented Feb 21, 2019

implemented in #29887

@xabbuh xabbuh closed this as completed Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants