Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8873989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:36:25+00:00 2026-06-14T18:36:25+00:00

I have two fields in my admin/componsents/com_xxxxx/models/forms/xxxxx.xml file. these feed into an input form

  • 0

I have two fields in my admin/componsents/com_xxxxx/models/forms/xxxxx.xml file.

these feed into an input form for administrators on the back end of Joomla 2.5

<field name="f_start" type="calendar" class="inputbox" 
             required="true" 
             format="%Y-%m-%d %H:%M:%S"
             default="0000-00-00 09:30:00" 
             label="COM_xxxxx_F_START"
             description="COM_xxxxx_F_START_DESC" 
             filter="safehtml" /> 

<field name="f_end" type="calendar" class="inputbox"
             required="true" 
             format="%Y-%m-%d %H:%M:%S"
             default="0000-00-00 19:30:30" 
             label="COM_xxxxx_F_END"
             description="COM_xxxxx_F_END_DESC" 
             filter="safehtml" /> 

These are essentially start and end dates of when an article is published.
however when selecting the datepicker/calendar icon and choosing a date the
field is updated to the date chosen but keeps the 09:30:00 default start time.
this seems to work for times between 01:30:00 through to 11:30 any afternoon times get reset to now when a date is selected.

can anyone explain why?
or how to keep the default times on the date selector?

if the end date could also default to 28 days from the start date?

thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:36:26+00:00Added an answer on June 14, 2026 at 6:36 pm

    When clicking on the calendar icon, the calendar widget tries to position itself on the date contained in the corresponding text field. As 0000-00-00 is an invalid date, the Date.parseDate function in media/system/js/calendar-uncompressed.js tries to guess the date from all components of the format string. 0000-00-00 09:30:00 is recognized as Sep 30, because 09 < 12, so it looks like a month number, and thus it returns Sep 30, 9:30. On the other hand, 0000-00-00 19:30:00 is not recognized as any valid date, and the function returns today. Hence the difference in the time part.

    If you look at the XML form files for com_content for example, you’ll see that they don’t use default values for the calendar fields.

    You could however create a custom field type derived from JFormFieldCalendar which would give you full flexibility. For example:

    forms/whatever.xml

    <field name="f_start" type="PubDateCalendar"
           format="%Y-%m-%d %H:%M:%S" default="start" ... />
    <field name="f_end" type="PubDateCalendar"
           format="%Y-%m-%d %H:%M:%S" default="end" ... />
    

    fields/pubdatecalendar.php

    <?php
    defined('_JEXEC') or die;
    jimport('joomla.form.helper');
    JFormHelper::loadFieldClass('calendar');
    
    class JFormFieldPubDateCalendar extends JFormFieldCalendar
    {
        public $type = 'PubDateCalendar';
        protected function getInput()
        {
            $format = $this->element['format']
                    ? (string) $this->element['format']
                    : '%Y-%m-%d';
            if ($this->element['default'] == 'start') {
                $this->value = strftime($format);
            } else if ($this->element['default'] == 'end') {
                $this->value = strftime($format, time() + 28 * 24 * 60 * 60);
            }
            return parent::getInput();
        }
    }
    ?>
    

    or whatever suits your particular application better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've modified schema.xml to have two fields, one for stemming, and one for no
I have these two models : class Module(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(unique=True,
I have two fields on the form ( forgotpassword form ) username and email
I have two fields in separate linked tables with the same data, but different
I have two fields on my web page ie: BookAuthor and BookDescription.On submit,the page
I have two fields - amount (decimal (11, 2)) - gift_amount (decimal (11, 2))
I have two fields that need to multiply each other and fill a third
I have two fields which calculate a total, but I have a radio button
I have two fields that I'd like to match. (already done the validation functions
Say I have two fields in a new or edit form: <%= f.text_field :email

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.