plomino / Plomino

Powerful and flexible web-based application builder
33 stars 37 forks source link

date/time field for 2021... #859

Closed lucamancini closed 3 years ago

lucamancini commented 3 years ago

Hi all, when I save a document containing a date/time field with a date in 2021 (i.e. 2021/01/14), Plomino saves correctly but when I edit the document, the calendar shows 2020/12/31. Saving again, the date remains correct.

For 2020 and past, everything is correct.

Date settings for Plomino database are %d-%m-%Y.

Could you help me?

ebrehault commented 3 years ago

do you have the same behavior the 2 datetime field rendering options (JQuery and default)?

lucamancini commented 3 years ago

My date in the document is 2021-01-30. This is what I see when edit the document Immagine 2021-01-07 180731 Analyzing the page the date is right Immagine 2021-01-07 180714

lucamancini commented 3 years ago

In the document properties we have the following Immagine 2021-01-07 182355

This behaviour happens to all the date/time fields since january 1st

ebrehault commented 3 years ago

ok so you're using the JS widget Does it work if you switch to the default widget rendering?

ermancio commented 3 years ago

Please suggest me how to switch

ebrehault commented 3 years ago

I do not remember well but if you edit the date field, there is a settings tab or something and you can pick a different rendering widget.

lucamancini commented 3 years ago

I tried to work on the settings of the date field. These are the available settings

Immagine 2021-01-08 102236

It doesn't work.

It's a very strange thing that for every date in 2021, the field shows 2020/12/31 during editing... It seems to be a date limit....

Maybe we can try to set some settings in portal_properties/site_properties?

Immagine 2021-01-08 102952

ebrehault commented 3 years ago

ok maybe it is not in settings but in the main field property, but there is definitely a way to change the widget

lucamancini commented 3 years ago

Please, Eric, could you help me to know how?

ebrehault commented 3 years ago

I really do not remember well enough

could you screenshot the field edit page?

lucamancini commented 3 years ago

Immagine 2021-01-08 123557

lucamancini commented 3 years ago

This is the visualization mode for 2021 date

Immagine 2021-01-08 123807

and this is in edit mode

Immagine 2021-01-08 123837

For a document with a date in 2020 I have

Immagine 2021-01-08 124102

and

Immagine 2021-01-08 124122

ebrehault commented 3 years ago

So when you are on the Default edit page you've screenshotted, if you click on the Settings tab, don't you see a parameter named "Field rendering"?

fulv commented 3 years ago

I've seen some github issues floating around in the last few days that might be related. Apparently, there is some ArcheTypes code that sets the upper limit for date fields to Dec 31, 2020. -- Fulvio

On Fri, Jan 8, 2021 at 9:08 AM Eric BREHAULT notifications@github.com wrote:

So when you are on the Default edit page you've screenshotted, if you click on the Settings tab, don't you see a parameter named "Field rendering"?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/plomino/Plomino/issues/859#issuecomment-756773396, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADQPRSLHASKMPPUD3AWNWDSY4GVZANCNFSM4VZFIFLQ .

ebrehault commented 3 years ago

ok, so a new flavour of Y2K bug

Sorry @lucamancini, if that's the case, it means it probably won't be fixed (Archetypes is not maintained anymore, so the only way is to fix Plomino so it does not use the Archetypes code anymore when managing dates).

fulv commented 3 years ago

The Archetypes issue might be a red herring, I don't know. Perhaps it only affects older versions of Archetypes. But if that is the problem, then a monkeypatch could fix it. -- Fulvio

On Fri, Jan 8, 2021 at 10:10 AM Eric BREHAULT notifications@github.com wrote:

ok, so a new flavour of Y2K bug

Sorry @lucamancini https://github.com/lucamancini, if that's the case, it means it probably won't be fixed (Archetypes is not maintained anymore, so the only way is to fix Plomino so it does not use the Archetypes code anymore when managing dates).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/plomino/Plomino/issues/859#issuecomment-756805841, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADQPRVKWPL5HTHBGOGU7D3SY4N7XANCNFSM4VZFIFLQ .

lucamancini commented 3 years ago

Ok Fulvio. Unfortunately I'm not a programmer. Any hint for me? Is there a way out?

lucamancini commented 3 years ago

[https://github.com/plone/Products.Archetypes/issues/133]

lucamancini commented 3 years ago

I fixed it! In products.cmfplone-4.2.0.1-py2.6.egg\Products\CMFPlone\skins\plone_scripts/date_components_support.py` and plone.app.form-2.1-py2.6.egg\plone\app\form\widgets/datecomponents.py

you need to modify PLONE_CEILING=DateTime(2021,0) # 2020-12-31 in PLONE_CEILING = DateTime(2500, 0) # 2499-12-31

Now my 12-year old son will sleep soundly...

ebrehault commented 3 years ago

ahahaha!!!!!!!!!!!! that's great! congrats! I love the messages sequence:

Unfortunately I'm not a programmer

same guy, 1 hour later:

In products.cmfplone-4.2.0.1-py2.6.egg\Products\CMFPlone\skins\plone_scripts/date_components_support.py` and plone.app.form-2.1-py2.6.egg\plone\app\form\widgets/datecomponents.py you need to modify PLONE_CEILING=DateTime(2021,0) # 2020-12-31 in PLONE_CEILING = DateTime(2500, 0) # 2499-12-31

Maybe you are not a programmer, but you must be the not-a-programmer-with-very-good-programming-skills type then :)

lucamancini commented 3 years ago

Thank you Eric! See you soon