Octopoos / SEBLOD

Build high-end websites with SEBLOD®, a CCK for Joomla!
https://www.seblod.com
GNU General Public License v2.0
129 stars 54 forks source link

There is a problem with the calendar field only on PHP 8, it works on PHP 7.4 #679

Open webmasterpaca opened 1 year ago

webmasterpaca commented 1 year ago

There is a problem with the calendar field only on PHP 8, it works on PHP 7.4 I enter 2023-07-06 09:45:00 in the form. The form registers 2023-07-06 07:45:00. Database registers 2023-07-06 03:45:00

Is it a bug? Thank you for your help!

(Seblod 3.23.1 and Joomla 3.10.11)

NativoDigital commented 1 year ago

Hi @ll, I'm not sure if we are talking about the same problem.

I have a date field which stores date in standard format 0000-00-00

In php7.x there is no problem, but with php8.x, when adding content there is no problem, but when editing the object of the content type, after saving it the date change to -1 days. E.G.:

Original date is 2022-12-27, after editing the object and saving it (without touching the date while editing) it changes to 2022-12-26

There is no time in the field. Only date. When I change again to php7.x the problem dissapears.

Best regards. Adonay

Giuse69 commented 1 year ago

Same for me: the date is saved one day before than what was entered with PHP 8.1

webmasterpaca commented 1 year ago

Hi, With PHP8, when I save my content, the time in the date field goes back one hour. This happens with every save. For example, if I record 3 times, the date goes back 3 hours. The problem is that the error only occurs with PHP8, with PHP7 it works fine. The time zone is "Europe/Paris" (+1), if I use "London" (+0) it works fine. Each record adds +1 from the Paris time zone. I have the latest version of Joomla 3.10.11 and Seblod 3.23.1

sebastienheraud commented 1 year ago

Hi, Is it with the "Calendar" field or the "JForm - Calendar" field? The old Calendar field will be removed from the Core, and won't be updated anymore, please use the "JForm - Calendar". Feel free to confirm. Thanks, Saba

webmasterpaca commented 1 year ago

Hi Saba, Thank you for your answer, I am using the old calendar field. I didn't know it won't be updated anymore. So I'm going to replace it with the JForm - Calendar" field. How do I know which field will be dropped with Seblod 4, so that I can replace them? Thank you in advance for your answer.

NativoDigital commented 1 year ago

Hi Saba, thank you for your answer. Actually the issue is in both plugins: JForm and Picker Calendar as I have been able to verify some minutes ago.

Thank you again. Best regards

Giuse69 commented 1 year ago

Hi, the problem with JForm Calendar is that it does not support comparison in Search: with Picker (that I confirm has the bug of this thread) we can put something like "-3 months" as Live Value in a Search View to filter items with recent dates. That does not work with JForm, or maybe we need a different syntax. thanks

Giuse

NativoDigital commented 1 year ago

so the value now, or others as yesterday, now-1, and so on, used for example as a timestamp in a “live value” of a hidden field will no longer be possible?

https://www.php.net/manual/en/function.strtotime.php

sebastienheraud commented 1 year ago

Hi @Giuse69, @NativoDigital,

Is there any reason you don't use the DateTime Live plug-in? It features the modifier and -3 months works without any issue as far as I know.

Saba

NativoDigital commented 1 year ago

Well, I'm not sure, I would need to test in some seblod applications if I can replace the functionalities of Calendar Picker with those of JForm Calendar and Datetime. I didn't know about Datetime field before you mentioned it, thank you.

I'll test this as soon as I can.

webmasterpaca commented 1 year ago

Hi, @NativoDigital do not announce a bug before having produced it. It's very confusing for the developer and the users not to know what is true and what is false. Tanks

NativoDigital commented 1 year ago

@webmasterpaca of course the two bugs reported in this ticket are tested. So I don't really know what you mean

webmasterpaca commented 1 year ago

@NativoDigital You assumed that the values "yesterday", "now", etc, would no longer be valid. I thought you had tested.

webmasterpaca commented 1 year ago

Hi @sebastienheraud I tested with the Jform calendar control. That works well. The time is well recorded. However, regardless of the selected storage time zone "server" or "user" the stored time is the same. Thanks

NativoDigital commented 1 year ago

@webmasterpaca I do not assume anything, if you look at the end of my post there is a question symbol “?”. The one who said “That does not work with JForm, or maybe we need a different syntax.” was not me.

@sebastienheraud in my test, as I said, with JForm is also saving the time -1 on each edition when using php8.x

Giuse69 commented 1 year ago

@sebastienheraud about using the Datetime live plugin for search with JForm, maybe I am not using it correctly (the documentation does not explain how to use the parameters): if I set "-3 months" in the modifier box, leaving format = Auto and applying to a JForm Calendar field that is stored in the DB as a date column, tha page breaks with error

Failed to parse time string (2022-12-02 18-59-41) at position 11 (1): Unexpected character

Using the Picker, without any plugin filtering just works setting the Live value to "-3 months". If there is a way to use Datetime with JForm, I am happy to move to that. thanks

joomleb commented 1 year ago

Hi guys, @sebastienheraud we have some Seblod 3 sites that we will update to Seblod 4, but that they have no Seblod forms yet.

...The old Calendar field will be removed from the Core, and won't be updated anymore, please use the "JForm - Calendar"...."

Do you have a list of the deprecated fields etc. ? And instructions on how safely uninstall them ? (To keep the Seblod installation as clean as possible and to don't risk to incur in wrong usage in the near future (this J4 updates were a nightmare for us...)

NativoDigital commented 1 year ago

With JForm Calendar the problem disappears when Storage Format is set to Raw. While using Server Time Zone or User Time Zone, the problem is the same as with Calendar Picker.

Thank you Best regards.

webmasterpaca commented 1 year ago

Hi @sebastienheraud I tried "TODAY" and "1 YEAR" doesn't word with Jform calendar. Thanks

NativoDigital commented 1 year ago

Hi again @sebastienheraud

I have tried today by using JForm Calendar in combination with Datetime live field as you commented. The datetime field can retrieve friendly values in a text field, but it doesn't work retrieving the values in the JForm Calendar field.

Thank you for the last update. Best regards. Adonay

NativoDigital commented 1 year ago

Hi, sorry it works if we put the correct format. Format: Free -> Y-m-d H:i:s Modifier: now

Thank you!

Giuse69 commented 1 year ago

Yes, I too could make it work setting the format to the specific one - leaving the format to "auto" breaks the page. So for me it is ok to use the JForm Calendar :)

NativoDigital commented 1 year ago

Hi @Giuse69, in my case there is still one problem regarding this issue that I can’t solve.

It is on the search/list form. If we put the date for example: 2023/04/02 the returned results are always one day less. In this case it returns all the results of 2023/04/01. So I told to the employees for the moment if they want to search for day 2, they should look at day 3.

Does the same happen to you?

NativoDigital commented 1 year ago

Hi @Giuse69, in my case there is still one problem regarding this issue that I can’t solve.

It is on the search/list form. If we put the date for example: 2023/04/02 the returned results are always one day less. In this case it returns all the results of 2023/04/01. So I told to the employees for the moment if they want to search for day 2, they should look at day 3.

Does the same happen to you?

Hi guys, @sebastienheraud, Thank you so much for the last upgrade to 4.0.3 I've tested this problem and it is still there. It's not very important but because this issue is waiting for feedback, I comment.

Best regards

NativoDigital commented 11 months ago

Hi @ll,

This calendar field can't be created through the joomla backend. The default value is incorrect. Actually a date or datetime column should has the possibility to be Null on the database. If the field is always filled it does no matter, but if the field can be left in blank (when filling the form), it must be Null in order to avoid an error.

The classical default values 0000-00-00 and 0000-00-00 00:00:00 are no longer valid.

Some more details about this