1127

How to handle an optional date in trongate framework

Comments for “How to handle an optional date in trongate framework”
 

Posted by horseman on Thursday 18th August 2022 at 15:13 GMT

I create a new Module with trongate desktop ap an define a not required property of type DATE.
If i create a new record and don't select a date (because is not aplicable for this special record), nevertheless the date is stored in the database as 1970-01-01.
It should be NULL or I'm wrong?
How to handle this type of optional Dates?
Level One Member

horseman

User Level: Level One Member

Date Joined: 9/08/2022

Posted by London Gypsy on Thursday 18th August 2022 at 16:13 GMT

Hi horseman,
I had the very same issue when I first started using Trongate.
You are not wrong, it should be null, but because the submit method sends an empty string if a date is not set,
MySQL and mariadb sets a default value in the date field, which is what you are seeing as a Unix timestamp.
Have a look at this thread to see how it was resolved via DaFa's great suggestion.
https://trongate.io/help_bar/thread/8xrrqTzLRfcd

Cheers!

This comment was edited by London Gypsy on Thursday 18th August 2022 at 16:17 GMT

London Gypsy

User Level: Guest

Date Joined: 18/08/2022

Posted by horseman on Thursday 18th August 2022 at 20:21 GMT

Perfekt answer KeepCalm! Thump Up.
Level One Member

horseman

User Level: Level One Member

Date Joined: 9/08/2022

Posted by DaFa on Friday 19th August 2022 at 05:12 GMT

Hi horseman, could you please close this thread and award points to KeepCalm. There might be other open threads of yours that may need closing too.

Cheers

This comment was edited by DaFa on Friday 19th August 2022 at 10:04 GMT

Founding Member

DaFa

User Level: Founding Member

Date Joined: 30/11/2018

×