How to change Nulldate

  • Cynthia
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
13 years 6 months ago #5236 by Cynthia
How to change Nulldate was created by Cynthia
How do I change the nulldate?

Currently, if I don't enter date in the event (this is the case with events for which the client can choose the date himself) , it displays on the front end like this: 30-11-1999, 00:00 u. I guess this date comes out of a database somewhere.

I would be very happy if the date field disappears when no value is entered. Or that the date field displays nothing.

What code should I use in which file to change the null date?

I guess all users who have events for which the data is a variable, can benefit from this.

Best regards,
Cynthia

Please Log in or Create an account to join the conversation.

More
13 years 6 months ago #5275 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: How to change Nulldate
Hi

If you want to do that, here is the solution :

1. Open the file components/com_eventbooking/views/event/tmpl/default.php, look at the code from line 37 to line 44 :
Code:
<tr> <td style="width: 30%;"> <strong><?php echo JText::_('EB_EVENT_DATE') ?>:</strong> </td> <td> <?php echo JHTML::_('date', $item->event_date, $this->config->event_date_format, 0) ; ?> </td> </tr>

And change it to :
Code:
if ($item->event_date != $this->nullDate) { ?> <tr> <td style="width: 30%;"> <strong><?php echo JText::_('EB_EVENT_DATE') ?>:</strong> </td> <td> <?php echo JHTML::_('date', $item->event_date, $this->config->event_date_format, 0) ; ?> </td> </tr> <?php } The modified file is attached, too. You can download it, unzip and then upload it to components/com_eventbooking/views/event/tmpl folder . Regards, Tuan

Attachment default-20101024.zip not found

Attachments:

Please Log in or Create an account to join the conversation.

  • Cynthia
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
13 years 6 months ago #5278 by Cynthia
Replied by Cynthia on topic Re: How to change Nulldate
Hi Tuan,

Thank you for the code and the attachment (great service, that makes it even easier). I uploaded this new default.php file.
I made a new event and left the fields of the 'event start date' and 'event end date' blank.
At the front end the end date is gone now (perfect!), but the start date still shows the default value 30-11-1999. Any idea how we can make this default value dissapear too?

Best regards,
Cynthia
Attachments:

Please Log in or Create an account to join the conversation.

  • Cynthia
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
13 years 6 months ago #5381 by Cynthia
Replied by Cynthia on topic Re: How to change Nulldate
Hi Tuan,

If you could have a look how to get rid of the standard date 30-11-1999 when the event date field is left blank (and just get a blank space), I would be very happy. My client needs to go live end this week and this is an issue for them.
In advance I would like to thank you for your time.

Cynthia

Please Log in or Create an account to join the conversation.

  • Cynthia
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
13 years 5 months ago #5747 by Cynthia
Replied by Cynthia on topic Re: How to change Nulldate
Does someone on this forum knows how to change the default date 30-11-1999 (which occurs when the event date is left blank) into 00-00-0000? It would be most helpful! Thanks.
Cynthia

Please Log in or Create an account to join the conversation.

  • Cynthia
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
13 years 5 months ago #5951 by Cynthia
Replied by Cynthia on topic Re: How to change Nulldate
I found why the nulldate 0000-00-00 (when the date field is left blank) returns 1999-11-30. For anyone that likes some math:

*PHP* timestamps is the same range as UNIX timestamps and work like this: The year 0000 is taken as 2000, due to Y2K handling. (Years 00-68 are assumed to be 2000-2068 and 69-99 are 1969-1999.) Arguably, it should be distinguishing 00 from 0000, but it doesn't.

January is month 1, so "month 0" is one month before that, December.

Similarly "day 0" is one day before the first of the month: the last day of the previous month.

Therefore 0000-00-00 is one day before one month before 2000-01-01, giving 1999-11-30.

So it makes sense, even if it is fundamentally wrong!

The only solution I can think of, is this: if no date is filled in, the date field should be hidden at the front end.
Tuan, do you know how to change the code to make this work?


Best regards,
Cynthia

Please Log in or Create an account to join the conversation.

More
13 years 5 months ago #5984 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: How to change Nulldate
Hi Cynthia

Please update your site to version 1.2.0 of Event Booking and the issue will be solved .

Thanks,

Tuan

Please Log in or Create an account to join the conversation.

  • Cynthia
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
13 years 4 months ago #6078 by Cynthia
Replied by Cynthia on topic Re: How to change Nulldate
I installed version 1.2.0, but the nulldate still shows 30-11-1999. The other new features are awesome though!
Is there a possibility to add some code to make the date dissappear when left blank?

Please Log in or Create an account to join the conversation.

More
13 years 4 months ago #6093 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: How to change Nulldate
Hi Cynthia

It works fine for other clients, so I don't know why It doesn't work for your site. Could you please send me administrator account of your site so that I can check it for you ?

Sorry for lately response. I just moved to new , better office :) .

Thanks,

Tuan

Please Log in or Create an account to join the conversation.

  • Cynthia
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
13 years 4 months ago #6269 by Cynthia
Replied by Cynthia on topic Re: How to change Nulldate
Hi Tuan,
For your information: I sent the admin account info to contact@joomdonation.com on 8 December.
Best regards, Cynthia

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc