Feature Documentation Required PBF PR-5.2-dev Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
2 Apr 2022

Summary of Changes

Add 2 new input date (DateField class), and datetime-local (DatetimeField class). Fix Time field to support filter.

Links to MDN docs:
datetime-local: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local
date: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date

Testing Instructions

Add fields in some XML, example in to mod_custom params:

<field type="date" name="date" label="Date"/>
<field type="time" name="time" label="Time" filter="SERVER_UTC"/>
<field type="datetime" name="datetime" label="Date Time" filter="SERVER_UTC"/>

Expected result AFTER applying this Pull Request

Edit the fields, make sure the input works and values stored/displayed corectly

Documentation Changes Required

Add new fields info to list of fields: https://docs.joomla.org/Standard_form_field_types

avatar Fedik Fedik - open - 2 Apr 2022
avatar Fedik Fedik - change - 2 Apr 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 2 Apr 2022
Category Layout Libraries
avatar Fedik Fedik - change - 2 Apr 2022
Labels Added: ? Documentation Required ?
avatar Fedik Fedik - change - 2 Apr 2022
Title
[4.2] Date and Datetime fields
[4.2] New Date and Datetime fields
avatar Fedik Fedik - edited - 2 Apr 2022
avatar Fedik
Fedik - comment - 2 Apr 2022

Oh date time is deprecated

yes

datetime-local

This is DateTime here

Unfortunately month and week have bad support by Browsers, probably for another time ?
Or maybe I make another PR for them, will see.

avatar brianteeman
brianteeman - comment - 2 Apr 2022

Could you update the description please to be datetime not datetimelocal

avatar brianteeman
brianteeman - comment - 2 Apr 2022

What happens with non gregorian calendars?

avatar Fedik
Fedik - comment - 2 Apr 2022

What happens with non gregorian calendars?

It only gregorian. It is standart date and datetime-local input, works as described in HTML specs.
No more no less ?

avatar Fedik
Fedik - comment - 2 Apr 2022

Could you update the description please to be datetime not datetimelocal

Wich description do you mean?
It actualy displaing datetime-local, because datetime is deprecated (see @dgrammatiko coment)

avatar Fedik Fedik - change - 2 Apr 2022
The description was changed
avatar Fedik Fedik - edited - 2 Apr 2022
avatar Fedik Fedik - change - 2 Apr 2022
The description was changed
avatar Fedik Fedik - edited - 2 Apr 2022
avatar Fedik Fedik - change - 2 Apr 2022
The description was changed
avatar Fedik Fedik - edited - 2 Apr 2022
avatar brianteeman
brianteeman - comment - 2 Apr 2022

image

avatar Fedik
Fedik - comment - 2 Apr 2022

@brianteeman that is correct.
Xml <field type="datetime"/> (wich is DatetimeField class in PHP), will render <input type="datetime-local">

avatar brianteeman
brianteeman - comment - 2 Apr 2022

nice and confusing

avatar laoneo
laoneo - comment - 4 Apr 2022

I would also deprecate our calendar field in favor of this one.

avatar Fedik
Fedik - comment - 4 Apr 2022

I would also deprecate our calendar field in favor of this one.

it not replacement, because it does not support non gregorian calendars

avatar laoneo
laoneo - comment - 4 Apr 2022

How do we handle gregorian calendars then?

avatar Fedik
Fedik - comment - 4 Apr 2022

How do we handle gregorian calendars then?

I assume you mean "non gregorian".
There a helper JS depend from language, one for jalali https://github.com/joomla/joomla-cms/blob/4.1-dev/build/media_source/system/js/fields/calendar-locales/date/jalali/date-helper.es5.js

avatar laoneo
laoneo - comment - 4 Apr 2022

Is this loaded then in this field?

avatar Fedik
Fedik - comment - 4 Apr 2022

Is this loaded then in this field?

Nope, that coded specificaly for calendar.js, it cannot be used somwhere else.
Only calendar field support "gregorian" and "non gregorian" calendars, that why it cannot be as replacement.

Also see my answer to Brian #37456 (comment)

avatar laoneo
laoneo - comment - 9 Apr 2022

If this pr can't be used in core, then I doubt we should add it. Especially when the fields can't be used all the languages we are supporting.

avatar Fedik
Fedik - comment - 9 Apr 2022

The fields is part of HTML5, that was missed in Form API.

Especially when the fields can't be used all the languages we are supporting.

They can be used, they translated by Browser.
It offers what HTML specification offers.

Support for different Calendars format it a huge different topic.

avatar brianteeman
brianteeman - comment - 9 Apr 2022

agree with @Fedik

avatar a-muk
a-muk - comment - 9 Apr 2022

Is this issue still open? If yes, can I contribute to it?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37456.

avatar chmst
chmst - comment - 9 Apr 2022

@a-muk sure, everyone can contribute :) I'll assign this to you for now.

avatar Fedik
Fedik - comment - 9 Apr 2022

If yes, can I contribute to it?

All is needed for this PR is to be tested ?

avatar chmst
chmst - comment - 9 Apr 2022

so sorry - i have too many tasks.:) @a-muk yes - now the work means testing

avatar a-muk
a-muk - comment - 9 Apr 2022

Okay. Thank you @Fedik @chmst

avatar dgrammatiko
dgrammatiko - comment - 13 Apr 2022

@laoneo could you elaborate on your thumbs down? Shouldn't Joomla implement the full HTML5 specs, and if so why?

avatar laoneo
laoneo - comment - 19 Apr 2022

@laoneo could you elaborate on your thumbs down? Shouldn't Joomla implement the full HTML5 specs, and if so why?

You answered it here perfectly #36346 (comment). The core can never use this field, because we want to support also none gregorian calendars.

avatar dgrammatiko
dgrammatiko - comment - 20 Apr 2022

You answered it here perfectly #36346 (comment). The core can never use this field, because we want to support also none gregorian calendars.

You're mixing different things here. My comment that you are mentioning is about a tables sorting functionality that is totally a Joomla invented/created/coded thing but this PR is about adding some of the W3C platfrom's missing input types. So, yes Joomla shouldn't roll functionality about imaginary use cases (in the case of my comment the dev was going against the Joomla's architecture: items are direct descendants of a single category and asking to extend the functionality to cover their case) but also Joomla should FULLY support the HTML5 elements. Also Joomla rolls a few more input types that aren't actually used by the core, so that's not even an argument against, eg:

avatar laoneo
laoneo - comment - 20 Apr 2022

Joomla should FULLY support the HTML5 elements

Why? All I see here is a maintenance burden (even when it is small).

Color is used on many places, tel is used in contact and time in scheduler. Perhaps you should search other examples. Even then, when something can't be used in core, we should not add it.

Perhaps I miss here something, but from a maintainer point of view this looks like something which should be either published as custom field or in the respective extension, but not in core.

avatar brianteeman
brianteeman - comment - 20 Apr 2022

, tel is used in contact

No its not

name="telephone"
type="text"
label="COM_CONTACT_FIELD_INFORMATION_TELEPHONE_LABEL"

avatar brianteeman
brianteeman - comment - 20 Apr 2022

Honestly @laoneo its a pathetic argument that you are making. I'm sure we all have better things to do

avatar dgrammatiko
dgrammatiko - comment - 20 Apr 2022

but not in core.

Here is were I strongly disagree. For me ALL the HTML5 input fields should be provided from Joomla core for 2 reasons:

  • Joomla's byproduct IS HTML5
  • the core SHOULD roll those input types so devs cannot use their names for their own fields to prevent collisions (actually every dev should prefixing their input types/names so that won't ever be a thing)

But anyways, that's my point of view. Also one more thought here, if the maintainers of the project feeling intimidated to actually implement the full HTML5 specs then probably they shouldn't be maintainers of a WEB CMS...

avatar brianteeman
brianteeman - comment - 20 Apr 2022

time in scheduler.

Yes it is the only place that uses it today as of 4.1 but it was added to the code base 3 years ago when nothing used it #26184

Read the closing comments from @wilsonge who actually understands joomla

avatar laoneo
laoneo - comment - 20 Apr 2022

How should an extension dev use this field then? Tell his customers that his extension is not working with gregorian calendars, but the rest of Joomla does?

If we are discussing on that level, then I'm out of this discussion. Do whatever you guys think is best for Joomla.

avatar brianteeman
brianteeman - comment - 20 Apr 2022

How should an extension dev use this field then? Tell his customers that his extension is not working with gregorian calendars, but the rest of Joomla does?

You mean non-gregorian calendars.

avatar joomla-bot
joomla-bot - comment - 27 Jun 2022

This pull requests has been automatically converted to the PSR-12 coding standard.

avatar Fedik Fedik - change - 2 Jul 2022
Labels Added: ?
avatar Fedik Fedik - change - 2 Jul 2022
Title
[4.2] New Date and Datetime fields
[4.x] New Date and Datetime fields
avatar Fedik Fedik - edited - 2 Jul 2022
avatar HLeithner
HLeithner - comment - 26 Oct 2022

I'm in favor for this PR, we can add a comment to the field that the browser support vor non-gregorian doesn't exists (yet) and the developer must decide if he/she needs it or not.

avatar brianteeman
brianteeman - comment - 26 Oct 2022

As long as this is a custom field and core doesnt change to use this field eg for publishing then I 100% agree as stated before.

avatar obuisard obuisard - change - 26 Oct 2022
Labels Removed: ?
avatar Fedik Fedik - change - 26 Mar 2023
Title
[4.x] New Date and Datetime fields
New Date and Datetime fields
avatar Fedik Fedik - edited - 26 Mar 2023
avatar Fedik Fedik - change - 23 Apr 2023
Title
New Date and Datetime fields
[5.0] New Date and Datetime fields
avatar Fedik Fedik - edited - 23 Apr 2023
avatar Fedik Fedik - change - 10 Jun 2023
Labels Added: Feature PR-5.0-dev
Removed: ? ?
281362d 10 Jun 2023 avatar Fedik phpcs
72b21ca 24 Aug 2023 avatar Fedik year
avatar HLeithner
HLeithner - comment - 30 Sep 2023

This pull request has been automatically rebased to 5.1-dev.

avatar Fedik Fedik - change - 20 Jan 2024
Title
[5.0] New Date and Datetime fields
[5.1] New Date and Datetime fields
avatar Fedik Fedik - edited - 20 Jan 2024
avatar Fedik Fedik - change - 20 Jan 2024
Labels Added: PR-5.1-dev
avatar TLWebdesign TLWebdesign - test_item - 24 Feb 2024 - Tested unsuccessfully
avatar TLWebdesign
TLWebdesign - comment - 24 Feb 2024

I have tested this item ? unsuccessfully on 00f151d

Tested this item unsuccessfully on J5.0.3

The time field is not saved. The other two work just fine but what a god awful UI with these fields.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37456.

avatar Fedik Fedik - change - 28 Feb 2024
Labels Added: PBF
avatar Fedik Fedik - change - 19 Mar 2024
Title
[5.1] New Date and Datetime fields
[5.x] New Date and Datetime fields
avatar Fedik Fedik - edited - 19 Mar 2024
avatar HLeithner HLeithner - change - 24 Apr 2024
Title
[5.x] New Date and Datetime fields
[5.2] New Date and Datetime fields
avatar HLeithner HLeithner - edited - 24 Apr 2024
avatar Fedik Fedik - change - 2 Jun 2024
Labels Added: PR-5.2-dev
Removed: PR-5.0-dev PR-5.1-dev
avatar HLeithner
HLeithner - comment - 2 Sep 2024

This pull request has been automatically rebased to 5.3-dev.

avatar HLeithner HLeithner - change - 2 Sep 2024
Title
[5.2] New Date and Datetime fields
[5.3] New Date and Datetime fields
avatar HLeithner HLeithner - edited - 2 Sep 2024

Add a Comment

Login with GitHub to post a comment