[BUG] Due date format issue #2470

Closed
opened 2025-11-02 04:37:28 -06:00 by GiteaMirror · 17 comments
Owner

Originally created by @mmarif4u on GitHub (Oct 30, 2018).

I guess the following image would explain the issue better.

capture

Originally created by @mmarif4u on GitHub (Oct 30, 2018). - Gitea version (or commit ref): 5fc0a12 - Can you reproduce the bug at https://try.gitea.io: - [x] Yes - [ ] No - [ ] Not relevant I guess the following image would explain the issue better. ![capture](https://user-images.githubusercontent.com/1280585/47705779-86b95a00-dc62-11e8-82c0-b0bac20e26ab.PNG)
GiteaMirror added the type/bug label 2025-11-02 04:37:28 -06:00
Author
Owner

@eloyekunle commented on GitHub (Oct 31, 2018):

On which page do you currently experience this issue?

@eloyekunle commented on GitHub (Oct 31, 2018): On which page do you currently experience this issue?
Author
Owner

@lafriks commented on GitHub (Oct 31, 2018):

It is on issue page

@lafriks commented on GitHub (Oct 31, 2018): It is on issue page
Author
Owner

@kolaente commented on GitHub (Oct 31, 2018):

We already have multiple issues regarding this, should we use some library to handle date formatting?

@kolaente commented on GitHub (Oct 31, 2018): We already have multiple issues regarding this, should we use some library to handle date formatting?
Author
Owner

@kanozec commented on GitHub (Oct 31, 2018):

But I saw the response of "https://try.gitea.io/api/v1/repos/{userName}/{repoName}/issues/1/deadline" in the chrome console is 401

And the request payload is {due_date: "2017-02-17T00:00:00.000Z"}

This issue seems not caused by error formating

@kanozec commented on GitHub (Oct 31, 2018): But I saw the response of "https://try.gitea.io/api/v1/repos/{userName}/{repoName}/issues/1/deadline" in the chrome console is 401 And the request payload is {due_date: "2017-02-17T00:00:00.000Z"} This issue seems not caused by error formating
Author
Owner

@kolaente commented on GitHub (Oct 31, 2018):

@kanocz anything in the logs?

@kolaente commented on GitHub (Oct 31, 2018): @kanocz anything in the logs?
Author
Owner

@kanozec commented on GitHub (Oct 31, 2018):

I only have the browser console log.

screen shot 2018-10-31 at 7 43 44 pm

Actually, I have some trouble to run gitea on my local.

@kanozec commented on GitHub (Oct 31, 2018): I only have the browser console log. ![screen shot 2018-10-31 at 7 43 44 pm](https://user-images.githubusercontent.com/30459655/47786081-9198eb00-dd45-11e8-9c0b-52a3df4701e5.png) Actually, I have some trouble to run gitea on my local.
Author
Owner

@kolaente commented on GitHub (Oct 31, 2018):

@kanocz What was the response?

Also, if you have problems running Gitea locally, feel free to ask in our Discord server or the forum.

@kolaente commented on GitHub (Oct 31, 2018): @kanocz What was the response? Also, if you have problems running Gitea locally, feel free to ask in [our Discord server](https://discord.gg/NsatcWJ) or [the forum](https://discourse.gitea.io/).
Author
Owner

@kanozec commented on GitHub (Oct 31, 2018):

[Macaron] 2018-10-31 21:10:17: Completed POST /api/v1/repos/Kee1234/gggg/issues/1/deadline 401 Unauthorized in 8.82763ms

I got this on my local environment.

The response was 401. Since the client ajax call got the 401 error, the js function setDeadline() handle the error in the same way. So it shows the "The due date is invalid or out of range. Please use the format 'yyyy-mm-dd' " on the page.

@kanozec commented on GitHub (Oct 31, 2018): ### [Macaron] 2018-10-31 21:10:17: Completed POST /api/v1/repos/Kee1234/gggg/issues/1/deadline 401 Unauthorized in 8.82763ms I got this on my local environment. The response was 401. Since the client ajax call got the 401 error, the js function setDeadline() handle the error in the same way. So it shows the "The due date is invalid or out of range. Please use the format 'yyyy-mm-dd' " on the page.
Author
Owner

@jamesa commented on GitHub (Oct 31, 2018):

This also happens in the Swagger dashboard for the same request.

@jamesa commented on GitHub (Oct 31, 2018): This also happens in the Swagger dashboard for the same request.
Author
Owner

@kolaente commented on GitHub (Nov 1, 2018):

Looks like this was broken by #4840 (among other things)

@kolaente commented on GitHub (Nov 1, 2018): Looks like this was broken by #4840 (among other things)
Author
Owner

@kanozec commented on GitHub (Nov 1, 2018):

@kolaente Yes, I trace the code and make some experiments. I found that

ctx.Data["IsApiToken"] = true

does not be executed while checking user is signed.

So

func reqToken() macaron.Handler {
	return func(ctx *context.Context) {
		for  key := range ctx.Data{
			fmt.Printf("Key: %s |Value: %v\n", key, ctx.Data[key])
		}
		if true != ctx.Data["IsApiToken"] {
			ctx.Error(401)
			return
		}
	}
}

always gets 401 error.

#5249 shows the solution to fix this bug

@kanozec commented on GitHub (Nov 1, 2018): @kolaente Yes, I trace the code and make some experiments. I found that ```golang ctx.Data["IsApiToken"] = true ``` does not be executed while checking user is signed. So ```golang func reqToken() macaron.Handler { return func(ctx *context.Context) { for key := range ctx.Data{ fmt.Printf("Key: %s |Value: %v\n", key, ctx.Data[key]) } if true != ctx.Data["IsApiToken"] { ctx.Error(401) return } } } ``` always gets 401 error. ### #5249 shows the solution to fix this bug
Author
Owner

@kolaente commented on GitHub (Nov 1, 2018):

I've opened #5249 to fix this and other issues.

@kolaente commented on GitHub (Nov 1, 2018): I've opened #5249 to fix this and other issues.
Author
Owner

@nikitasius commented on GitHub (Dec 17, 2018):

why this issue is closed?

Problem still here:

image

on https://try.gitea.io

@nikitasius commented on GitHub (Dec 17, 2018): why this issue is closed? Problem still here: ![image](https://user-images.githubusercontent.com/3670331/50082569-98929480-01f1-11e9-8f5c-7cbd4e064ccd.png) on https://try.gitea.io
Author
Owner

@kolaente commented on GitHub (Dec 17, 2018):

It looks like it returns an error 500, so maybe some other thing is broken and the error message is just not good...

@kolaente commented on GitHub (Dec 17, 2018): It looks like it returns an error 500, so maybe some other thing is broken and the error message is just not good...
Author
Owner

@nikitasius commented on GitHub (Dec 17, 2018):

Yep, it send a payload:
image
and receive nothing
image

@nikitasius commented on GitHub (Dec 17, 2018): Yep, it send a payload: ![image](https://user-images.githubusercontent.com/3670331/50087889-c253b780-0201-11e9-9322-c6c60d2767d0.png) and receive nothing ![image](https://user-images.githubusercontent.com/3670331/50087911-d13a6a00-0201-11e9-9914-b3b5ad6e3a4d.png)
Author
Owner

@lunny commented on GitHub (Jan 9, 2019):

@nikitasius could you confirm that #5250 didn't resolve the issue?

@lunny commented on GitHub (Jan 9, 2019): @nikitasius could you confirm that #5250 didn't resolve the issue?
Author
Owner

@nikitasius commented on GitHub (Jan 9, 2019):

@nikitasius could you confirm that #5250 didn't resolve the issue?

Hi, it was on your official demo. If you don't see on your official demo same error - guess it's fixed. Just check.

@nikitasius commented on GitHub (Jan 9, 2019): > @nikitasius could you confirm that #5250 didn't resolve the issue? Hi, it was on your **official demo**. If you don't see on your official demo same error - guess it's fixed. Just check.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2470