Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.1] New Date and Datetime fields #37456

Open
wants to merge 22 commits into
base: 5.1-dev
Choose a base branch
from
Open

Conversation

Fedik
Copy link
Member

@Fedik Fedik commented Apr 2, 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

@Fedik Fedik changed the title [4.2] Date and Datetime fields [4.2] New Date and Datetime fields Apr 2, 2022
@dgrammatiko
Copy link
Contributor

dgrammatiko commented Apr 2, 2022

@Fedik
Copy link
Member Author

Fedik commented Apr 2, 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.

@brianteeman
Copy link
Contributor

Could you update the description please to be datetime not datetimelocal

@brianteeman
Copy link
Contributor

What happens with non gregorian calendars?

Co-authored-by: Brian Teeman <brian@teeman.net>
@Fedik
Copy link
Member Author

Fedik commented Apr 2, 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 😉

@Fedik
Copy link
Member Author

Fedik commented Apr 2, 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)

@brianteeman
Copy link
Contributor

image

@Fedik
Copy link
Member Author

Fedik commented Apr 2, 2022

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

@brianteeman
Copy link
Contributor

nice and confusing

@laoneo
Copy link
Member

laoneo commented Apr 4, 2022

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

@Fedik
Copy link
Member Author

Fedik commented Apr 4, 2022

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

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

@laoneo
Copy link
Member

laoneo commented Apr 4, 2022

How do we handle gregorian calendars then?

@Fedik
Copy link
Member Author

Fedik commented Apr 4, 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

@joomla-bot
Copy link
Contributor

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

@Fedik Fedik changed the title [4.2] New Date and Datetime fields [4.x] New Date and Datetime fields Jul 2, 2022
@HLeithner HLeithner removed the psr12 label Oct 23, 2022
@HLeithner
Copy link
Member

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.

@HLeithner HLeithner changed the base branch from 4.2-dev to 4.3-dev October 26, 2022 13:02
@brianteeman
Copy link
Contributor

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.

@Quy Quy removed the PR-4.2-dev label Feb 16, 2023
@Fedik Fedik changed the title [4.x] New Date and Datetime fields New Date and Datetime fields Mar 26, 2023
@Fedik Fedik changed the base branch from 4.3-dev to 5.0-dev March 30, 2023 10:32
@Fedik Fedik changed the title New Date and Datetime fields [5.0] New Date and Datetime fields Apr 23, 2023
@HLeithner HLeithner changed the base branch from 5.0-dev to 5.1-dev September 30, 2023 22:51
@HLeithner
Copy link
Member

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

@Fedik Fedik changed the title [5.0] New Date and Datetime fields [5.1] New Date and Datetime fields Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet