GithubHelp home page GithubHelp logo

metamodels / attribute_timestamp Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 7.0 264 KB

The timestamp (date/time) attribute

License: GNU Lesser General Public License v3.0

PHP 100.00%
attribute-timestamp metamodel metamodels metamodels-attribute php

attribute_timestamp's People

Contributors

andreasisaak avatar baumannsven avatar bytehead avatar davidmaack avatar dependabot-preview[bot] avatar discordier avatar dmolineus avatar minimodel avatar richardhj avatar stefanheimes avatar zonky2 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

attribute_timestamp's Issues

Ausgabe des Datums im Filter erfolgt als Timestamp.

Hallo zusammen,

aktuell ist Metamodel 1.1 nighly in Contao 3.2.10 eingerichtet.

Das Feld "Datum" wird in einer Detailansicht auch als "lesbares Datum (23.06.2014)" ausgegeben.
mm-date-fe-detail

Als Filter ausgewählt wird nur der Timestamp angezeigt.

mm-date-filter

Ist das noch ein Bug oder müssen Templates angepasst werden, um eine lesbare Datumsausgabe zu erreichen?

Besten Dank und Gruß
Thomas

Schema "Datum und Zeit"

Waehlt man in der Attributkonfiguration "Datum und Zeit" kann keine Zeit angegeben werden.
Fehlermeldung : "Bitte geben Sie das Datum im Format "DD.MM.YYYY" ein!"

[Tng] Format timestamp attribute

Hi,
i have update my MetaModels to TNG version.

I have a timestamp filed on my application.
If I insert a new record or update a record, I have this error:
DateTime::__construct(): Failed to parse time string (24/05/2014) at position 0 (2): Unexpected character

The date is 24/05/2014

In Contao the date format is d/m/Y
if the date is similar to 05/10/2013, the error is not present
I think it's a problem with the date format.

Remove datepicker if readonly is active

We should change the getFieldDefinition. If the "readonly" is active we don't need the Datepicker. Because the datepicker is able to set a new Date.

    public function getFieldDefinition($arrOverrides = array())
    {
        $strDateType                 = $this->getDateTimeType();
        $readOnly                    = $this->getOverrideValue('readonly', $arrOverrides);
        $arrFieldDef                 = parent::getFieldDefinition($arrOverrides);
        $arrFieldDef['eval']['rgxp'] = $strDateType;
        if (!$readOnly) {
            $arrFieldDef['eval']['datepicker'] = ($strDateType !== 'time');
        }

        return $arrFieldDef;
    }

FEE - Property datetime (timestamp) does not accept the value date time

Checklist before I submit this issue report

I confirm that:

My environment is:

(Please fill in the actual values from your environment)

Key Value Comments
PHP version: 7.4
Contao version: 4.9.13
MetaModels version: 2.2@dev
Installation via composer (yes)
Installed MetaModels packages all

Issue description

FEE - Property datetime (timestamp) did not accept the value date time

Steps to reproduce

Create an attribute date / Datum with the Schema Datum und Uhrzeit
Display the field in FEE in the Browser
Type a number or the date and time.

Describe the behaviour of the application

We will see the error message
Das Feld "date-time" darf höchstens 10 Zeichen lang sein!
Property datetime (timestamp) did not accept the value (The values differ. Encountered type integer expected string (Found 0, expected '1970-01-01 00:00')).

Describe the expected behaviour of the application

It should be possible to type the date and the time as 03.02.2020 12:12
If defined in the attributes it works for just the date 03.02.2020
and also for Jost the time 12:12

Screenshots

Bildschirmfoto 2021-04-07 um 22 22 38

Bildschirmfoto 2021-04-07 um 22 16 35

(Add some visual love or even a video if you can)

Upgrade handler breaks fresh installation

Checklist before I submit this issue report

I confirm that:

This is a follow up on MetaModels/core#1108

My environment is:

Key Value Comments
PHP version: 5.6.30 / 128M
Contao version: 3.5.24
MetaModels version: Nightly
Installation via composer: (yes/no) NO
Installed MetaModels packages:
DCG version:

Issue description

Installation via FTP not possible - DB error
Check also my post here.
https://community.contao.org/de/showthread.php?66395-Installation-nicht-m%C3%B6glich&p=437618#post437618

Steps to reproduce

  1. Download Nightly
  2. Upload FTP
  3. Try to create tables over install.php

Describe the behaviour of the application

Error :)

Fatal error: Query error: Table 'contao.tl_metamodel_attribute' doesn't exist (SELECT metamodel.tableName, attribute.colname FROM tl_metamodel_attribute AS attribute LEFT JOIN tl_metamodel AS metamodel ON (metamodel.id=attribute.pid) WHERE attribute.type='timestamp')
#0 /DOMAIN.com/system/modules/core/library/Contao/Database/Statement.php(264): Contao\Database\Statement->query()
#1 /DOMAIN.com/system/modules/metamodelsattribute_timestamp/classes/src/MetaModels/Attribute/Timestamp/Helper/UpgradeHandler.php(79): Contao\Database\Statement->execute('timestamp')
#2 /DOMAIN.com/system/modules/metamodelsattribute_timestamp/classes/src/MetaModels/Attribute/Timestamp/Helper/UpgradeHandler.php(55): MetaModels\Attribute\Timestamp\Helper\UpgradeHandler->ensureCorrectColumnType()
#3 /DOMAIN.com/system/modules/!metamodels-tng-branch/config/runonce_1.php(25): MetaModels\Attribute\Timestamp\Helper\UpgradeHandler->perform()
#4 /DOMAIN.com/system/modules/!metamodels-tng-branch/config/runonce.php(14): require_once('/home/recenmbt/...')
#5 /DOMAIN.com/system/modules/!metamodels-tng-branch/config/runonce.php(36): runonce_f9467bbca9cbfa38d987eee4638796a8->run()
#6 /DOMAIN.com/system/modules/core/classes/Backend.php(273): include('/home/recenmbt/...')
#7 /DOMAIN.com/system/modules/core/controllers/BackendInstall.php(628): Contao\Backend->handleRunOnce() #8 /DOMAIN.com/system/modules/core/controllers/BackendInstall.php(177): Contao\BackendInstall->adjustDatabaseTables()
#9 /DOMAIN.com/contao/install.php(24): Contao\BackendInstall->run()
#10 {main} in system/modules/!metamodels-tng-branch/config/runonce.php on line 22
#0 [internal function]: __error(256, 'Query error: Ta...', '/home/domain/...', 22, Array)
#1 system/modules/!metamodels-tng-branch/config/runonce.php(22): trigger_error('Query error: Ta...', 256)
#2 system/modules/!metamodels-tng-branch/config/runonce.php(36): runonce_f9467bbca9cbfa38d987eee4638796a8->run()
#3 system/modules/core/classes/Backend.php(273): include('/home/domain/...')
#4 system/modules/core/controllers/BackendInstall.php(628): Contao\Backend->handleRunOnce()
#5 system/modules/core/controllers/BackendInstall.php(177): Contao\BackendInstall->adjustDatabaseTables()
#6 contao/install.php(24): Contao\BackendInstall->run()
#7 {main}

Name                                             Version       Last modification
========================================================================================
http://c-c-a.org/
contao-community-alliance/dc-general             2.0.0-beta38  2016-08-23T13:32:18+00:00
contao-community-alliance/dependency-container   1.8.3         2015-12-08T01:53:46+00:00
contao-community-alliance/event-dispatcher       1.3.0         2014-11-28T14:49:55+00:00
contao-community-alliance/events-contao-bindings 3.5.1         2016-05-04T08:26:41+00:00
contao-community-alliance/translator             2.0.2         2015-11-25T18:42:08+00:00
----------------------------------------------------------------------------------------

http://bit3.de
contao-community-alliance/meta-palettes          1.10.0        2016-10-26T06:51:58+00:00
----------------------------------------------------------------------------------------

https://www.cyberspectrum.de
discordier/justtextwidgets                       1.0.0         2015-10-27T02:38:03+00:00
----------------------------------------------------------------------------------------

http://www.doctrine-project.org
doctrine/cache                                   v1.5.4        2015-12-19T05:03:47+00:00
----------------------------------------------------------------------------------------

http://www.leo-unglaub.net
leounglaub/contao-simple-ajax                    1.0.2         2014-02-07T22:35:55+00:00
----------------------------------------------------------------------------------------

http://www.minifier.org
matthiasmullie/minify                            1.3.44        2017-03-16T16:42:50+00:00
----------------------------------------------------------------------------------------

http://github.com/matthiasmullie/path-converter
matthiasmullie/path-converter                    1.1.0         2017-01-26T08:54:49+00:00
----------------------------------------------------------------------------------------

http://www.men-at-work.de
menatwork/contao-multicolumnwizard               3.3.10        2017-02-27T17:54:10+00:00
----------------------------------------------------------------------------------------

http://now.metamodel.me/
metamodels/attribute_alias                       2.0.0         2016-05-03T22:07:57+00:00
metamodels/attribute_checkbox                    2.0.1         2017-01-12T03:35:57+00:00
metamodels/attribute_combinedvalues              2.0.1         2017-03-06T19:35:43+00:00
metamodels/attribute_country                     2.0.0         2016-05-30T19:41:08+00:00
metamodels/attribute_decimal                     2.0.0         2016-05-09T15:28:30+00:00
metamodels/attribute_file                        2.0.0         2016-05-30T16:39:30+00:00
metamodels/attribute_langcode                    2.0.0         2016-12-07T06:41:50+00:00
metamodels/attribute_longtext                    2.0.0         2017-01-12T04:14:51+00:00
metamodels/attribute_numeric                     2.0.0         2017-01-12T04:54:18+00:00
metamodels/attribute_rating                      2.0.0         2017-02-28T01:18:52+00:00
metamodels/attribute_select                      2.0.0         2017-02-22T21:36:14+00:00
metamodels/attribute_tabletext                   2.0.0         2017-02-07T00:06:43+00:00
metamodels/attribute_tags                        2.0.0         2017-02-27T23:31:19+00:00
metamodels/attribute_text                        2.0.0         2017-02-28T00:05:33+00:00
metamodels/attribute_timestamp                   2.0.1         2017-01-16T10:15:26+00:00
metamodels/attribute_translatedalias             2.0.0         2017-01-12T01:50:38+00:00
metamodels/attribute_translatedcheckbox          2.0.0         2016-05-04T10:03:08+00:00
metamodels/attribute_translatedcombinedvalues    2.0.0         2017-02-07T01:54:26+00:00
metamodels/attribute_translatedfile              2.0.0         2017-02-28T09:13:40+00:00
metamodels/attribute_translatedlongtext          2.0.0         2017-02-07T00:58:51+00:00
metamodels/attribute_translatedselect            2.0.0         2017-02-07T01:40:21+00:00
metamodels/attribute_translatedtabletext         2.0.1         2017-03-08T20:36:21+00:00
metamodels/attribute_translatedtags              2.0.0         2017-02-27T23:42:42+00:00
metamodels/attribute_translatedtext              2.0.0         2016-12-08T17:31:54+00:00
metamodels/attribute_translatedurl               2.0.0         2017-02-07T02:25:07+00:00
metamodels/attribute_url                         2.0.1         2016-09-27T19:34:47+00:00
metamodels/bundle_all                            2.0.0         2015-11-11T21:55:59+00:00
metamodels/bundle_attributes                     2.0.1         2016-05-04T09:37:14+00:00
metamodels/bundle_filter                         2.0.0         2015-11-11T21:01:14+00:00
metamodels/bundle_nontranslated                  2.0.1         2016-05-04T09:23:22+00:00
metamodels/bundle_translated                     2.0.1         2016-05-04T09:11:51+00:00
metamodels/core                                  2.0.0-alpha14 2016-08-24T16:27:48+00:00
metamodels/filter_checkbox                       2.0.0         2016-05-30T21:54:34+00:00
metamodels/filter_fromto                         2.0.0         2016-05-30T22:28:20+00:00
metamodels/filter_range                          2.0.0         2016-05-30T22:55:02+00:00
metamodels/filter_select                         2.0.0         2017-01-10T22:19:55+00:00
metamodels/filter_tags                           2.0.0         2017-02-14T21:08:49+00:00
metamodels/filter_text                           2.0.1         2017-03-08T23:22:24+00:00
----------------------------------------------------------------------------------------

http://pimple.sensiolabs.org
pimple/pimple                                    v1.1.1        2013-11-22T08:30:29+00:00
----------------------------------------------------------------------------------------

https://symfony.com
symfony/event-dispatcher                         v2.8.19       2017-04-03T20:37:06+00:00
symfony/expression-language                      v2.8.19       2017-04-03T23:11:44+00:00
----------------------------------------------------------------------------------------

other
contao-community-alliance/url-builder            1.1.3         2015-12-23T16:50:06+00:00

Finalize 2.0.0

TODO:

[TNG] Timestamp Attribut Darstellungs Fehler

Contao 3.3.3
MM TNG über Composer

Beim klick auf das Datums Icon fehlt die komplette Formatierung des JS Kalenders
( Siehe links oben und links unten )
Die Datepicker.js wird geladen, die Console gibt keinerlei Errors. Die Funktion des Cal. funktioniert auch weiterhin nur eben greifen hier anscheinend keine CSS Regeln.

20140705-171828-899

Datepicker works wrong after date is once selected

Hi!
I'm using the timestamp attribute with 'Date and time' format and the datepicker.
But there is currently an issue with the datepicker afterwards a date/time have been selected.

First I select a date and time with the datepicker:
datepicker1

After a date and time have been inserted into the timestamp field I click on the datepicker again and now it displays 1970/01/01:
datepicker2

I'm using Contao 3.5.12 with Composer:
composer

Thanks for your great work!

Wrong grouping by date field

It appears as though grouping elements by a date field is not supported correctly. This is how the list is displayed:

listenansicht

But actually, the date of the elements is set to 01.01.2010, not 01.01.1970:

datum

And these are the settings:

einstellungen

[TNG] Rendersetting Format G:i \U\h\r klappt nicht

Hi,

nach PHP date() sollte "G:i \U\h\r" ja "20:00 Uhr" ausgeben, wenn ich das in das Formatfeld Einstellungen mache erscheint aber

20:00 \1406491200\08\Sun, 27 Jul 2014 20:00:00 +0000

Das date escaping scheint da nicht durchzukommen ...

timestamp to date Problematik

Wer mit dem Attribut 'timestamp' arbeitet, sieht sich bald mit folgendem Problem konfrontiert: Im Backend als 2011-08-20 erfasst, möchte ich diesen Wert in einer Liste nur als Jahr (2011) ausgeben, in der Detailansicht jedoch das ausgeschriebene, lokalisierte Datum sehen, z.B. 20. August 2011. Bei der lokalisierten Datumsabgabe muss ich jedoch mit Arrays arbeiten, da date() grundsätzlich nur Englische Begriffe ausgibt. Gibt es eine Möglichkeit im Backend das Datumsformat und die Sprachversion anzugeben?
(Anbei beide überarbeiteten Attributs-Templates)
mm_attr_timestamp_year
mm_attr_timestamp_tag_monat_jahr

Leere Datumsfelder nicht ausfüllen

Im FE werden leere Datumsfelder mit dem Standardwert 01.01.1970 ausgegeben. Das ist ärgerlich wenn man explizit auf leere Felder prüfen möchte.

Enhance data input to clear certain parts of the timestamp.

Issue description

When editing timestamps with formats where parts are missing (Year, day, month, hour, minute, second), PHP does initialize it with the current time() value.
This is correct and good from PHP side, as formats like +1 week are perfectly legal and useful, yet it will break our filtering.

So we need some way to restrict time or date to "zero" in order to allow valid filtering and omit hickups like discussed in MetaModels/filter_fromto#9.

Proposed solution

The idea I had is to add some input screen configuration setting where the user can select one of three possible settings:

  1. do nothing (default and current behaviour)
  2. clear data part (will restrict the date to 01.01.1970 internally).
  3. clear time part (will restrict the time to 00:00:00 internally).

I'd put this setting into the input screen definition of the attribute instance to allow variation of this in the concrete input screens.

Implementation would then be to change the current implementation something along the lines of:

    public function handleEncodePropertyValueFromWidget(EncodePropertyValueFromWidgetEvent $event)
    {
        $attribute = $this->getSupportedAttribute($event);
        if (!$attribute) {
            return;
        }

        $date       = \DateTime::createFromFormat($attribute->getDateTimeFormatString(), $event->getValue());
        $properties = $event->getEnvironment()->getDataDefinition()->getPropertiesDefinition();
        $property   = $properties->getProperty($event->getProperty());
        $extra      = $property->getExtra();
        if (isset($extra['clear'])) {
            switch ($extra['clear']) {
                case 'time':
                    $date->setTime(0, 0, 0);
                    break;
                case 'date':
                    $date->setDate(0, 0, 0);
                    break;
                default:
            }
        }

        if ($date) {
            $event->setValue($date->getTimestamp());
        }
    }

Of course we would also have to add such setting to the fromto filter regarding dates, as otherwise date filtering would begin and end "now" and therefore might not find items due to the offset.

Timestamp korrigiert Daten die vor 1901 liegen falsch

Das Timestamp-Feld kennt ein Datum erst ab 1901, ich habe aber Daten die zum Beispiel im Jahr 1863 liegen.

Das Feld korrigiert diese dann immer fälschlicherweis auf 1901.

Contao 2.x verarbeitet das Datum korrekt, auch der Datepicker übergibt ein korrektes Datum ans Datumsfeld.

[TNG] Datum wird nicht gespeichert

Wenn ich ein Attribut-Timestamp anlege und ein Datum eingebe, wird dieses nicht richtig gespeichert und im Backend wird dann 01.01.1970 ausgegeben.

Ich habe mir den Prozess des speicherns auch einmal etwas genauer angesehen. So wie es für mich aussieht, wird nirgendwo das Datum ( zum Beispiel 30.05.2014 ) zurück in einen Timestamp konvertiert. Meiner Meinung nach müsste an dieser Stelle:
https://github.com/MetaModels/attribute_timestamp/blob/tng/src/system/modules/metamodelsattribute_timestamp/MetaModels/Attribute/Timestamp/Timestamp.php#L128-L131
Eine konvertierung zurück in einen Timestamp erfolgen. Liege ich damit richtig?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.