Skip to content

[Form] Fixed few issues with Date and Time #1485

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

Merged
merged 2 commits into from
Jul 4, 2011

Conversation

stloyd
Copy link
Contributor

@stloyd stloyd commented Jun 30, 2011

Fixed few issues with Date and Time:

* TimeType:
  - seconds are no longer populated if "with_seconds" = false
  - "widget = text" is now properly rendered (closes symfony#1480)
* DateTimeToStringTransformer:
  - fixed using not default "format" (probably fix symfony#1183)
* DateType, DateTimeType, TimeType:
  - fixed "input = datetime" and test covered
  - a bit changed readability
@@ -101,15 +109,26 @@ class DateTimeType extends AbstractType

if ($options['input'] === 'string') {
$builder->appendNormTransformer(new ReversedTransformer(
new DateTimeToStringTransformer($options['data_timezone'], $options['data_timezone'], $format)
new DateTimeToStringTransformer(
$options['data_timezone'],
Copy link
Member

Choose a reason for hiding this comment

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

Can you revert this kind of changes? Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO this make code a bit more readable, but reverted it ;-)

$dateTime = new \DateTime($value, new \DateTimeZone($this->outputTimezone));

// Force value to be in same format as given to transform
if ($value !== $dateTime->format($this->format)) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this piece of code. What are you trying to do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FFS... GitHub lost my comment :( Ok lets write it again but short:

It's "fix/hack" for rendering TimeType and $options['with_seconds'] = false, to explain it check those tests: old vs. new.

fabpot added a commit that referenced this pull request Jul 4, 2011
Commits
-------

3917ed7 Revert "* DateType, DateTimeType, TimeType: - a bit changed readability"
c85b815 Fixed few issues with Date and Time:

Discussion
----------

[Form] Fixed few issues with Date and Time

Fixed few issues with Date and Time:

* TimeType:
  - seconds are no longer populated if "with_seconds" = false
  - "widget = text" is now properly rendered (closes #1480)
* DateTimeToStringTransformer:
  - fixed using not default "format" (probably fix #1183)
* DateType, DateTimeType, TimeType:
  - fixed "input = datetime" and test covered
@fabpot fabpot merged commit 3917ed7 into symfony:master Jul 4, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Form/Twig] Twig cannot render a form
2 participants