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

Replace jquery-datetimepicker with native date input #11684

Merged
merged 2 commits into from
Jun 10, 2020

Conversation

silverwind
Copy link
Member

This removes the jQuery plugin as well as the associated config options. Native input[type=date] does not require a language attribute as it is localized by default, except for the placeholder attribute for which I currently piggy-back the repo.issues.due_date_form localization option.

Implementation should pretty much match GH. Of note is that Safari does not provide a UI for this input type, but I don't think providing one is neccessary and GH did not bother either.

Before:
image

After:
image

@CirnoT
Copy link
Contributor

CirnoT commented May 29, 2020

Something very weird is going on, when I select any date, the date set is always +1 day from what I selected.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 29, 2020
@silverwind
Copy link
Member Author

silverwind commented May 29, 2020

Works on my end:

image

Try it on GH's milestone create page, it should behave the same.

@CirnoT
Copy link
Contributor

CirnoT commented May 29, 2020

Works fine on GitHub; the issue isn't with native date picker, the date selected and sent to server is fine, but date saved in database is always +1 day.

@silverwind
Copy link
Member Author

Weird. I see "2020-05-05" in the POST and on the rendered date afterwards.

@CirnoT
Copy link
Contributor

CirnoT commented May 29, 2020

Chromium sends
due_date: "2020-05-25T00:00:00.000Z"
And I see May 26 on rendered page.

@CirnoT
Copy link
Contributor

CirnoT commented May 29, 2020

In database it is set to 1590451199, that's why. Gitea timezone is +2 for me so 23:59 on 2020-05-25 is indeed 26th of May.

@silverwind
Copy link
Member Author

silverwind commented May 29, 2020

Is this a Chromium bug? I thought type=date should always send yyyy-mm-dd.

@silverwind
Copy link
Member Author

MDN says:

Value | A DOMString representing a date in YYYY-MM-DD format, or empty

@silverwind
Copy link
Member Author

Chrome 83 does the right thing:

image

Why is there due_date in your example?

@CirnoT
Copy link
Contributor

CirnoT commented May 29, 2020

I'm testing it on issue due date, assuming it should behave the same way.

@silverwind
Copy link
Member Author

silverwind commented May 29, 2020

Due date also sends with time info for me so there is a bug there that is not present on milestone.

@CirnoT
Copy link
Contributor

CirnoT commented May 29, 2020

Indeed, works fine on milestone. Wonder why due date sends time.

@silverwind
Copy link
Member Author

It's wrongly passing the date to the JS Date contructor.

@silverwind
Copy link
Member Author

silverwind commented May 29, 2020

I tried changing it to send yyyy-mm-dd format but the backend rejects that. Definitely a separate issue: #11686

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels May 29, 2020
@lunny lunny added the topic/ui Change the appearance of the Gitea UI label May 30, 2020
@silverwind
Copy link
Member Author

Any more reviews? This is ready from my side.

@CirnoT
Copy link
Contributor

CirnoT commented Jun 5, 2020

Need to resolve conflicts @silverwind

This removes the jQuery plugin as well as the associated config options.
Native input[type=date] does not require a language attribute as it is
localized by default, except for the placeholder attribute for which I
currently piggy-back the repo.issues.due_date_form localization option.

Implementation should pretty much match GH. Of note is that Safari does
not provide a UI for this input type, but I don't think providing one is
neccessary and GH did not bother either.
@silverwind
Copy link
Member Author

Yeah, just noticed that, rebased.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 10, 2020
@techknowlogick techknowlogick merged commit 628ee1d into go-gitea:master Jun 10, 2020
@silverwind silverwind deleted the datetime branch June 10, 2020 19:04
@lafriks lafriks added this to the 1.13.0 milestone Jun 10, 2020
ydelafollye pushed a commit to ydelafollye/gitea that referenced this pull request Jul 31, 2020
This removes the jQuery plugin as well as the associated config options.
Native input[type=date] does not require a language attribute as it is
localized by default, except for the placeholder attribute for which I
currently piggy-back the repo.issues.due_date_form localization option.

Implementation should pretty much match GH. Of note is that Safari does
not provide a UI for this input type, but I don't think providing one is
neccessary and GH did not bother either.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/ui Change the appearance of the Gitea UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants