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

DCG saves dates as formatted string #415

Open
richardhj opened this issue Jun 23, 2018 · 2 comments · May be fixed by #421
Open

DCG saves dates as formatted string #415

richardhj opened this issue Jun 23, 2018 · 2 comments · May be fixed by #421

Comments

@richardhj
Copy link
Member

richardhj commented Jun 23, 2018

My environment is:

(Please fill in the actual values from your environment)

Key Value Comments
PHP version: 7.2.
Contao version: 4.5
DC_General version: 2.1. same behaviour in v2.0
Installation via composer: yes

Issue description

DCG saves my time values as formatted string, and not as unix timestamp as expected.
Misconfiguration in my dca?

Steps to reproduce

<?php


$GLOBALS['TL_DCA'][$table] = [

    // Config
    'config'                => [
        'dataContainer'   => 'General',
        'notCreatable'    => true,
        'notDeletable'    => true,
    ],

    // MetaSubPalettes
    'metasubpalettes'       => [
        'published' => [
            'start',
            'stop',
        ],
    ],

    // Fields
    'fields'                => [
        'start'                 => [
            'label'     => &$GLOBALS['TL_LANG'][$table]['start'],
            'exclude'   => true,
            'inputType' => 'text',
            'eval'      => [
                'rgxp'       => 'datim',
                'datepicker' => true,
                'tl_class'   => 'w50 wizard',
            ],
            'sql'       => "varchar(10) NOT NULL default ''",
        ],
        'stop'                  => [
            'label'     => &$GLOBALS['TL_LANG'][$table]['stop'],
            'exclude'   => true,
            'inputType' => 'text',
            'eval'      => [
                'rgxp'       => 'datim',
                'datepicker' => true,
                'tl_class'   => 'w50 wizard',
            ],
            'sql'       => "varchar(10) NOT NULL default ''",
        ],
    ],
];

Describe the behaviour of the application

formatted date string in DB

Describe the expected behaviour of the application

unix timestamp

Screenshots

screen shot 2018-06-23 at 20 44 35

@zonky2 zonky2 added the bug label Jul 2, 2018
@zonky2 zonky2 added this to the 2.0.0 milestone Jul 2, 2018
@richardhj richardhj linked a pull request Aug 14, 2018 that will close this issue
6 tasks
@zonky2
Copy link
Contributor

zonky2 commented Aug 15, 2018

It is still my opinion that the Unix timestamp is not the most elegant format for MySQL to store date and time!

MySQL has a data format with a much wider range ('1000-01-01 00:00:00:00' to '9999-12-31 23:59:59') and saves the incorrect conversions from the timestamp - see also MetaModels/core#881

@baumannsven
Copy link
Member

@zonky2 Please make your statement in the pull #421

@zonky2 zonky2 modified the milestones: 2.0.0, 2.2.0 Aug 22, 2018
@zonky2 zonky2 modified the milestones: 2.2.0, 2.3.0 May 10, 2022
@zonky2 zonky2 modified the milestones: 2.3.0, 2.3.1 Oct 31, 2023
@zonky2 zonky2 modified the milestones: 2.3.1, 2.3.2, 2.4.0 Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants