?
avatar fuscage
fuscage
5 Mar 2020

Steps to reproduce the issue

Change a DATETIME field to DATE (in MYSQL)

ALTER TABLE jos_content CHANGE publish_down publish_down DATE NOT NULL DEFAULT '0000-00-00 00:00:00';

Open a content (with end publish date at empty) and see the field displays "30-11-2001 00:00:00" and doesn't display empty

image

Expected result

empty in field calendar

Actual result

"30-11-2001 00:00:00"

System information (as much as possible)

joomla 3.9.15, mysql

Additional comments

Because in the librairies/joomla/form/field/calendar.php file the getNullDate fonction return always the time??

// Format value when not nulldate ('0000-00-00 00:00:00'), otherwise blank it as it would result in 1970-01-01.
		if ($this->value && $this->value != JFactory::getDbo()->getNullDate() && strtotime($this->value) !== false)
		{ ...
avatar fuscage fuscage - open - 5 Mar 2020
avatar joomla-cms-bot joomla-cms-bot - change - 5 Mar 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 5 Mar 2020
avatar gerryfrancis
gerryfrancis - comment - 5 Mar 2020

Computers use values to interpret date and time. In theory, "0000-00-00 00:00:00" is the time when Jesus Christ was born, but the first computers were invented over 1900 years later. This date is not null, but it has a value that just cannot be processed. ;)

avatar fuscage fuscage - change - 9 Mar 2020
Title
Calendar field doesn't display empty value (MYSQL DATE column and not DATETIME column)
Calendar field doesn't display empty value (when mysql db type column is DATE and not DATETIME)
avatar fuscage fuscage - edited - 9 Mar 2020
avatar richard67
richard67 - comment - 12 Mar 2020

The calendar field is made for datetime, not for date database fields. Joomla core used datetime only (and on PostgreSQL timestamp withut time zone), not date.

So to be honest: I am not sure if this here is really an issue or a wrong usage of the calendar field.

avatar richard67
richard67 - comment - 12 Mar 2020

@wilsonge What do you think? Should the calendar field support date (without time) database column type? I don't think so, but I might be wrong.

avatar brianteeman
brianteeman - comment - 13 Mar 2020

I agree with you - its a date time field not a date field - at least as far as the definition of the field. Displaying of the date is a different issue and is down to the formatting of the data not how it is stored.

avatar Bakual
Bakual - comment - 13 Mar 2020

You certainly also need to adjust the calendar field format to not show the time. Also you need to remove the UTC filtering so no timezone is applied.

avatar richard67
richard67 - comment - 13 Mar 2020

@brianteeman @Bakual So what do you suggest? Closing as no issue?

avatar brianteeman brianteeman - change - 13 Mar 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-03-13 07:08:41
Closed_By brianteeman
avatar brianteeman brianteeman - close - 13 Mar 2020
avatar brianteeman
brianteeman - comment - 13 Mar 2020

Closed for the reasons stated above

Add a Comment

Login with GitHub to post a comment