Skip to content
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

Show and edit date in the same timezone #6167

Merged

Conversation

peter-gribanov
Copy link
Contributor

Subject

The date and datetime field has a timezone option that is used as second argument for Twig's date function (doc).

It seems wrong to me that the date is displayed in one time zone, and is being live-edited in another time zone. Due to the difference between the server time zone and the time zone specified in the options, we can get completely different dates, which can lead to administrative errors.

I assume that the time zone is used so that the administrator can specify his time zone and not look at all the dates in the server time zone. This is useful because JavaScript calendars do not know in which time zone the server is located and display the calendar in the user's time zone. If the time zone of the server and the user are different, this can also lead to problems.

Changelog

### Fixed
- Show and edit `date` and `datetime` in the same timezone

phansys
phansys previously approved these changes Jun 25, 2020
core23
core23 previously approved these changes Jun 26, 2020
@peter-gribanov peter-gribanov dismissed stale reviews from core23 and phansys via b3efa0e June 26, 2020 13:26
@peter-gribanov peter-gribanov force-pushed the show_and_edit_date_tz branch from 4c79b51 to b3efa0e Compare June 26, 2020 13:26
core23
core23 previously approved these changes Jun 26, 2020
phansys
phansys previously approved these changes Jul 22, 2020
jordisala1991
jordisala1991 previously approved these changes Jul 23, 2020
@jordisala1991
Copy link
Member

Phpstan is failing, you probably only need to rebase, can you do it @peter-gribanov ?

add convert timezone test

optimize convert timezone

not use assign operation inside the if condition

test change datetime on change timezone

create named datasets
@peter-gribanov peter-gribanov dismissed stale reviews from jordisala1991, phansys, and core23 via f11b482 July 24, 2020 12:22
@peter-gribanov peter-gribanov force-pushed the show_and_edit_date_tz branch from b3efa0e to f11b482 Compare July 24, 2020 12:22
@peter-gribanov
Copy link
Contributor Author

@jordisala1991 Yes. Sure

@jordisala1991 jordisala1991 merged commit 17083d3 into sonata-project:3.x Jul 24, 2020
@jordisala1991
Copy link
Member

Thank you @peter-gribanov

@peter-gribanov peter-gribanov deleted the show_and_edit_date_tz branch July 24, 2020 12:54
peter-gribanov added a commit to peter-gribanov/SonataAdminBundle that referenced this pull request Jul 24, 2020
allow use data_transformer in SetObjectFieldValueAction

create BooleanToStringTransformer for allows to use non-strings

update SetObjectFieldValueActionTest

use yoda conditions

fix errors in HelperControllerTest

test BooleanToStringTransformer

allow override transformers for 'date', 'boolean' and 'choice' field types

mark BooleanToStringTransformer and BooleanToStringTransformer classes as final

add example of using the data_transformer option in docs

add full docs about Symfony Data Transformers

optimize resolve Data Transformer

fix docs

create DataTransformerResolver service

add type hint for BooleanToStringTransformer::$trueValue

allow add a custom global transformers

field type should be a string

correct default value for $globalCustomTransformers

correct test DataTransformerResolverTest::testAddCustomGlobalTransformer()

add BC support usage of DataTransformerResolver

Update tests/Action/SetObjectFieldValueActionTest.php

Update tests/Action/SetObjectFieldValueActionTest.php

Update tests/Form/DataTransformer/BooleanToStringTransformerTest.php

Update tests/Form/DataTransformer/BooleanToStringTransformerTest.php

Update tests/Form/DataTransformerResolverTest.php

Update tests/Form/DataTransformerResolverTest.php

Update src/Action/SetObjectFieldValueAction.php

change "entity" word to "model" in documentations

change deprecated error message

add datetime in editable date form types

correct test transform datetime and date form types

test DateTime object in assertSame()

fix typo

restore getTemplate() return value in SetObjectFieldValueActionTest

use Yoda conditions

lazy-load predefined data transformers

add DataTransformerResolverInterface

use constants for determinate a field type

test laze-load data transformers

test usage DataTransformerResolver::addCustomGlobalTransformer()

create simple function in DataTransformerResolverTest

Process deprecation of FieldDescriptionInterface::getTargetEntity()

Use FieldDescriptionInterface::getTargetModel if exists sonata-project#6208

change usage getTargetEntity() -> getTargetModel() in DataTransformerResolverTest

merge changes from PR sonata-project#6167

register BooleanToStringTransformer as a service
peter-gribanov added a commit to peter-gribanov/SonataAdminBundle that referenced this pull request Jul 24, 2020
allow use data_transformer in SetObjectFieldValueAction

create BooleanToStringTransformer for allows to use non-strings

update SetObjectFieldValueActionTest

use yoda conditions

fix errors in HelperControllerTest

test BooleanToStringTransformer

allow override transformers for 'date', 'boolean' and 'choice' field types

mark BooleanToStringTransformer and BooleanToStringTransformer classes as final

add example of using the data_transformer option in docs

add full docs about Symfony Data Transformers

optimize resolve Data Transformer

fix docs

create DataTransformerResolver service

add type hint for BooleanToStringTransformer::$trueValue

allow add a custom global transformers

field type should be a string

correct default value for $globalCustomTransformers

correct test DataTransformerResolverTest::testAddCustomGlobalTransformer()

add BC support usage of DataTransformerResolver

Update tests/Action/SetObjectFieldValueActionTest.php

Update tests/Action/SetObjectFieldValueActionTest.php

Update tests/Form/DataTransformer/BooleanToStringTransformerTest.php

Update tests/Form/DataTransformer/BooleanToStringTransformerTest.php

Update tests/Form/DataTransformerResolverTest.php

Update tests/Form/DataTransformerResolverTest.php

Update src/Action/SetObjectFieldValueAction.php

change "entity" word to "model" in documentations

change deprecated error message

add datetime in editable date form types

correct test transform datetime and date form types

test DateTime object in assertSame()

fix typo

restore getTemplate() return value in SetObjectFieldValueActionTest

use Yoda conditions

lazy-load predefined data transformers

add DataTransformerResolverInterface

use constants for determinate a field type

test laze-load data transformers

test usage DataTransformerResolver::addCustomGlobalTransformer()

create simple function in DataTransformerResolverTest

Process deprecation of FieldDescriptionInterface::getTargetEntity()

Use FieldDescriptionInterface::getTargetModel if exists sonata-project#6208

change usage getTargetEntity() -> getTargetModel() in DataTransformerResolverTest

merge changes from PR sonata-project#6167

register BooleanToStringTransformer as a service
peter-gribanov added a commit to peter-gribanov/SonataAdminBundle that referenced this pull request Jul 24, 2020
allow use data_transformer in SetObjectFieldValueAction

create BooleanToStringTransformer for allows to use non-strings

update SetObjectFieldValueActionTest

use yoda conditions

fix errors in HelperControllerTest

test BooleanToStringTransformer

allow override transformers for 'date', 'boolean' and 'choice' field types

mark BooleanToStringTransformer and BooleanToStringTransformer classes as final

add example of using the data_transformer option in docs

add full docs about Symfony Data Transformers

optimize resolve Data Transformer

fix docs

create DataTransformerResolver service

add type hint for BooleanToStringTransformer::$trueValue

allow add a custom global transformers

field type should be a string

correct default value for $globalCustomTransformers

correct test DataTransformerResolverTest::testAddCustomGlobalTransformer()

add BC support usage of DataTransformerResolver

Update tests/Action/SetObjectFieldValueActionTest.php

Update tests/Action/SetObjectFieldValueActionTest.php

Update tests/Form/DataTransformer/BooleanToStringTransformerTest.php

Update tests/Form/DataTransformer/BooleanToStringTransformerTest.php

Update tests/Form/DataTransformerResolverTest.php

Update tests/Form/DataTransformerResolverTest.php

Update src/Action/SetObjectFieldValueAction.php

change "entity" word to "model" in documentations

change deprecated error message

add datetime in editable date form types

correct test transform datetime and date form types

test DateTime object in assertSame()

fix typo

restore getTemplate() return value in SetObjectFieldValueActionTest

use Yoda conditions

lazy-load predefined data transformers

add DataTransformerResolverInterface

use constants for determinate a field type

test laze-load data transformers

test usage DataTransformerResolver::addCustomGlobalTransformer()

create simple function in DataTransformerResolverTest

Process deprecation of FieldDescriptionInterface::getTargetEntity()

Use FieldDescriptionInterface::getTargetModel if exists sonata-project#6208

change usage getTargetEntity() -> getTargetModel() in DataTransformerResolverTest

merge changes from PR sonata-project#6167

register BooleanToStringTransformer as a service
peter-gribanov added a commit to peter-gribanov/SonataAdminBundle that referenced this pull request Jul 27, 2020
allow use data_transformer in SetObjectFieldValueAction

create BooleanToStringTransformer for allows to use non-strings

update SetObjectFieldValueActionTest

use yoda conditions

fix errors in HelperControllerTest

test BooleanToStringTransformer

allow override transformers for 'date', 'boolean' and 'choice' field types

mark BooleanToStringTransformer and BooleanToStringTransformer classes as final

add example of using the data_transformer option in docs

add full docs about Symfony Data Transformers

optimize resolve Data Transformer

fix docs

create DataTransformerResolver service

add type hint for BooleanToStringTransformer::$trueValue

allow add a custom global transformers

field type should be a string

correct default value for $globalCustomTransformers

correct test DataTransformerResolverTest::testAddCustomGlobalTransformer()

add BC support usage of DataTransformerResolver

Update tests/Action/SetObjectFieldValueActionTest.php

Update tests/Action/SetObjectFieldValueActionTest.php

Update tests/Form/DataTransformer/BooleanToStringTransformerTest.php

Update tests/Form/DataTransformer/BooleanToStringTransformerTest.php

Update tests/Form/DataTransformerResolverTest.php

Update tests/Form/DataTransformerResolverTest.php

Update src/Action/SetObjectFieldValueAction.php

change "entity" word to "model" in documentations

change deprecated error message

add datetime in editable date form types

correct test transform datetime and date form types

test DateTime object in assertSame()

fix typo

restore getTemplate() return value in SetObjectFieldValueActionTest

use Yoda conditions

lazy-load predefined data transformers

add DataTransformerResolverInterface

use constants for determinate a field type

test laze-load data transformers

test usage DataTransformerResolver::addCustomGlobalTransformer()

create simple function in DataTransformerResolverTest

Process deprecation of FieldDescriptionInterface::getTargetEntity()

Use FieldDescriptionInterface::getTargetModel if exists sonata-project#6208

change usage getTargetEntity() -> getTargetModel() in DataTransformerResolverTest

merge changes from PR sonata-project#6167

register BooleanToStringTransformer as a service
peter-gribanov added a commit to peter-gribanov/SonataAdminBundle that referenced this pull request Jul 27, 2020
allow use data_transformer in SetObjectFieldValueAction

create BooleanToStringTransformer for allows to use non-strings

update SetObjectFieldValueActionTest

use yoda conditions

fix errors in HelperControllerTest

test BooleanToStringTransformer

allow override transformers for 'date', 'boolean' and 'choice' field types

mark BooleanToStringTransformer and BooleanToStringTransformer classes as final

add example of using the data_transformer option in docs

add full docs about Symfony Data Transformers

optimize resolve Data Transformer

fix docs

create DataTransformerResolver service

add type hint for BooleanToStringTransformer::$trueValue

allow add a custom global transformers

field type should be a string

correct default value for $globalCustomTransformers

correct test DataTransformerResolverTest::testAddCustomGlobalTransformer()

add BC support usage of DataTransformerResolver

Update tests/Action/SetObjectFieldValueActionTest.php

Update tests/Action/SetObjectFieldValueActionTest.php

Update tests/Form/DataTransformer/BooleanToStringTransformerTest.php

Update tests/Form/DataTransformer/BooleanToStringTransformerTest.php

Update tests/Form/DataTransformerResolverTest.php

Update tests/Form/DataTransformerResolverTest.php

Update src/Action/SetObjectFieldValueAction.php

change "entity" word to "model" in documentations

change deprecated error message

add datetime in editable date form types

correct test transform datetime and date form types

test DateTime object in assertSame()

fix typo

restore getTemplate() return value in SetObjectFieldValueActionTest

use Yoda conditions

lazy-load predefined data transformers

add DataTransformerResolverInterface

use constants for determinate a field type

test laze-load data transformers

test usage DataTransformerResolver::addCustomGlobalTransformer()

create simple function in DataTransformerResolverTest

Process deprecation of FieldDescriptionInterface::getTargetEntity()

Use FieldDescriptionInterface::getTargetModel if exists sonata-project#6208

change usage getTargetEntity() -> getTargetModel() in DataTransformerResolverTest

merge changes from PR sonata-project#6167

register BooleanToStringTransformer as a service

merge changes from PR sonata-project#6144
peter-gribanov added a commit to peter-gribanov/SonataAdminBundle that referenced this pull request Jul 27, 2020
allow use data_transformer in SetObjectFieldValueAction

create BooleanToStringTransformer for allows to use non-strings

update SetObjectFieldValueActionTest

use yoda conditions

fix errors in HelperControllerTest

test BooleanToStringTransformer

allow override transformers for 'date', 'boolean' and 'choice' field types

mark BooleanToStringTransformer and BooleanToStringTransformer classes as final

add example of using the data_transformer option in docs

add full docs about Symfony Data Transformers

optimize resolve Data Transformer

fix docs

create DataTransformerResolver service

add type hint for BooleanToStringTransformer::$trueValue

allow add a custom global transformers

field type should be a string

correct default value for $globalCustomTransformers

correct test DataTransformerResolverTest::testAddCustomGlobalTransformer()

add BC support usage of DataTransformerResolver

Update tests/Action/SetObjectFieldValueActionTest.php

Update tests/Form/DataTransformer/BooleanToStringTransformerTest.php

Update tests/Form/DataTransformerResolverTest.php

Update src/Action/SetObjectFieldValueAction.php

change "entity" word to "model" in documentations

change deprecated error message

add datetime in editable date form types

correct test transform datetime and date form types

test DateTime object in assertSame()

fix typo

restore getTemplate() return value in SetObjectFieldValueActionTest

use Yoda conditions

lazy-load predefined data transformers

add DataTransformerResolverInterface

use constants for determinate a field type

test laze-load data transformers

test usage DataTransformerResolver::addCustomGlobalTransformer()

create simple function in DataTransformerResolverTest

Process deprecation of FieldDescriptionInterface::getTargetEntity()

Use FieldDescriptionInterface::getTargetModel if exists sonata-project#6208

change usage getTargetEntity() -> getTargetModel() in DataTransformerResolverTest

merge changes from PR sonata-project#6167

register BooleanToStringTransformer as a service

merge changes from PR sonata-project#6144
peter-gribanov added a commit to peter-gribanov/SonataAdminBundle that referenced this pull request Sep 4, 2020
allow use data_transformer in SetObjectFieldValueAction

create BooleanToStringTransformer for allows to use non-strings

update SetObjectFieldValueActionTest

use yoda conditions

fix errors in HelperControllerTest

test BooleanToStringTransformer

allow override transformers for 'date', 'boolean' and 'choice' field types

mark BooleanToStringTransformer and BooleanToStringTransformer classes as final

add example of using the data_transformer option in docs

add full docs about Symfony Data Transformers

optimize resolve Data Transformer

fix docs

create DataTransformerResolver service

add type hint for BooleanToStringTransformer::$trueValue

allow add a custom global transformers

field type should be a string

correct default value for $globalCustomTransformers

correct test DataTransformerResolverTest::testAddCustomGlobalTransformer()

add BC support usage of DataTransformerResolver

Update tests/Action/SetObjectFieldValueActionTest.php

Update tests/Form/DataTransformer/BooleanToStringTransformerTest.php

Update tests/Form/DataTransformerResolverTest.php

Update src/Action/SetObjectFieldValueAction.php

change "entity" word to "model" in documentations

change deprecated error message

add datetime in editable date form types

correct test transform datetime and date form types

test DateTime object in assertSame()

fix typo

restore getTemplate() return value in SetObjectFieldValueActionTest

use Yoda conditions

lazy-load predefined data transformers

add DataTransformerResolverInterface

use constants for determinate a field type

test laze-load data transformers

test usage DataTransformerResolver::addCustomGlobalTransformer()

create simple function in DataTransformerResolverTest

Process deprecation of FieldDescriptionInterface::getTargetEntity()

Use FieldDescriptionInterface::getTargetModel if exists sonata-project#6208

change usage getTargetEntity() -> getTargetModel() in DataTransformerResolverTest

merge changes from PR sonata-project#6167

register BooleanToStringTransformer as a service

merge changes from PR sonata-project#6144

Move internal configuration to PHP sonata-project#6284
peter-gribanov added a commit to peter-gribanov/SonataAdminBundle that referenced this pull request Sep 4, 2020
allow use data_transformer in SetObjectFieldValueAction

create BooleanToStringTransformer for allows to use non-strings

update SetObjectFieldValueActionTest

use yoda conditions

fix errors in HelperControllerTest

test BooleanToStringTransformer

allow override transformers for 'date', 'boolean' and 'choice' field types

mark BooleanToStringTransformer and BooleanToStringTransformer classes as final

add example of using the data_transformer option in docs

add full docs about Symfony Data Transformers

optimize resolve Data Transformer

fix docs

create DataTransformerResolver service

add type hint for BooleanToStringTransformer::$trueValue

allow add a custom global transformers

field type should be a string

correct default value for $globalCustomTransformers

correct test DataTransformerResolverTest::testAddCustomGlobalTransformer()

add BC support usage of DataTransformerResolver

Update tests/Action/SetObjectFieldValueActionTest.php

Update tests/Form/DataTransformer/BooleanToStringTransformerTest.php

Update tests/Form/DataTransformerResolverTest.php

Update src/Action/SetObjectFieldValueAction.php

change "entity" word to "model" in documentations

change deprecated error message

add datetime in editable date form types

correct test transform datetime and date form types

test DateTime object in assertSame()

fix typo

restore getTemplate() return value in SetObjectFieldValueActionTest

use Yoda conditions

lazy-load predefined data transformers

add DataTransformerResolverInterface

use constants for determinate a field type

test laze-load data transformers

test usage DataTransformerResolver::addCustomGlobalTransformer()

create simple function in DataTransformerResolverTest

Process deprecation of FieldDescriptionInterface::getTargetEntity()

Use FieldDescriptionInterface::getTargetModel if exists sonata-project#6208

change usage getTargetEntity() -> getTargetModel() in DataTransformerResolverTest

merge changes from PR sonata-project#6167

register BooleanToStringTransformer as a service

merge changes from PR sonata-project#6144

Move internal configuration to PHP sonata-project#6284
peter-gribanov added a commit to peter-gribanov/SonataAdminBundle that referenced this pull request Sep 7, 2020
allow use data_transformer in SetObjectFieldValueAction

create BooleanToStringTransformer for allows to use non-strings

update SetObjectFieldValueActionTest

use yoda conditions

fix errors in HelperControllerTest

test BooleanToStringTransformer

allow override transformers for 'date', 'boolean' and 'choice' field types

mark BooleanToStringTransformer and BooleanToStringTransformer classes as final

add example of using the data_transformer option in docs

add full docs about Symfony Data Transformers

optimize resolve Data Transformer

fix docs

create DataTransformerResolver service

add type hint for BooleanToStringTransformer::$trueValue

allow add a custom global transformers

field type should be a string

correct default value for $globalCustomTransformers

correct test DataTransformerResolverTest::testAddCustomGlobalTransformer()

add BC support usage of DataTransformerResolver

Update tests/Action/SetObjectFieldValueActionTest.php

Update tests/Form/DataTransformer/BooleanToStringTransformerTest.php

Update tests/Form/DataTransformerResolverTest.php

Update src/Action/SetObjectFieldValueAction.php

change "entity" word to "model" in documentations

change deprecated error message

add datetime in editable date form types

correct test transform datetime and date form types

test DateTime object in assertSame()

fix typo

restore getTemplate() return value in SetObjectFieldValueActionTest

use Yoda conditions

lazy-load predefined data transformers

add DataTransformerResolverInterface

use constants for determinate a field type

test laze-load data transformers

test usage DataTransformerResolver::addCustomGlobalTransformer()

create simple function in DataTransformerResolverTest

Process deprecation of FieldDescriptionInterface::getTargetEntity()

Use FieldDescriptionInterface::getTargetModel if exists sonata-project#6208

change usage getTargetEntity() -> getTargetModel() in DataTransformerResolverTest

merge changes from PR sonata-project#6167

register BooleanToStringTransformer as a service

merge changes from PR sonata-project#6144

merge changes from PR sonata-project#6284

compare date with time in DataTransformerResolverTest
VincentLanglet pushed a commit that referenced this pull request Sep 13, 2020
allow use data_transformer in SetObjectFieldValueAction

create BooleanToStringTransformer for allows to use non-strings

update SetObjectFieldValueActionTest

use yoda conditions

fix errors in HelperControllerTest

test BooleanToStringTransformer

allow override transformers for 'date', 'boolean' and 'choice' field types

mark BooleanToStringTransformer and BooleanToStringTransformer classes as final

add example of using the data_transformer option in docs

add full docs about Symfony Data Transformers

optimize resolve Data Transformer

fix docs

create DataTransformerResolver service

add type hint for BooleanToStringTransformer::$trueValue

allow add a custom global transformers

field type should be a string

correct default value for $globalCustomTransformers

correct test DataTransformerResolverTest::testAddCustomGlobalTransformer()

add BC support usage of DataTransformerResolver

Update tests/Action/SetObjectFieldValueActionTest.php

Update tests/Form/DataTransformer/BooleanToStringTransformerTest.php

Update tests/Form/DataTransformerResolverTest.php

Update src/Action/SetObjectFieldValueAction.php

change "entity" word to "model" in documentations

change deprecated error message

add datetime in editable date form types

correct test transform datetime and date form types

test DateTime object in assertSame()

fix typo

restore getTemplate() return value in SetObjectFieldValueActionTest

use Yoda conditions

lazy-load predefined data transformers

add DataTransformerResolverInterface

use constants for determinate a field type

test laze-load data transformers

test usage DataTransformerResolver::addCustomGlobalTransformer()

create simple function in DataTransformerResolverTest

Process deprecation of FieldDescriptionInterface::getTargetEntity()

Use FieldDescriptionInterface::getTargetModel if exists #6208

change usage getTargetEntity() -> getTargetModel() in DataTransformerResolverTest

merge changes from PR #6167

register BooleanToStringTransformer as a service

merge changes from PR #6144

merge changes from PR #6284

compare date with time in DataTransformerResolverTest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants