0

I changed

<field name="n_date" default="0000-00-00" class="inputbox" format="%Y-%m-%d" translateformat="false" showtime="false" singleheader="false" todaybutton="false" weeknumbers="false" filltable="false" type="calendar" label="Date" description="COM_LATESTNEWS_FORM_DESC_DETAIL_N_DATE" hint="COM_LATESTNEWS_FORM_LBL_DETAIL_N_DATE"/>

to

<field name="n_date" default="" type="calendar" class="inputbox" filter="safehtml" label="COM_LATESTNEWS_FORM_LBL_DETAIL_N_DATE" description="COM_LATESTNEWS_FORM_DESC_DETAIL_N_DATE" hint="COM_LATESTNEWS_FORM_LBL_DETAIL_N_DATE" required="true"/>

Reason of changing - date was incorrect showing in previous version of jan 2022 Now after changing whats happening is that n_date field coming as blank and has to manually select today date on clicking.

Is there a way by which default date should be picked and showed as today date when not selected by default

1 Answer 1

1

To show the current date or timedate as the default, you can simply use default="now".

Note, that you will also need to set translateformat="true"

You can read more about the Joomla Calendar Field here

2
  • Thanks, what if translateformat is not added. any harm ?
    – Ruchika
    Dec 22, 2022 at 7:12
  • I got PHP error, which is probably because the format of the default date needs to be able to be read within the actual calendar.
    – Lodder
    Dec 22, 2022 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.