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

*time. Time is inconsistent with time.Time conversion #2665

Closed
Rehtt opened this issue May 25, 2023 · 1 comment · Fixed by #2915
Closed

*time. Time is inconsistent with time.Time conversion #2665

Rehtt opened this issue May 25, 2023 · 1 comment · Fixed by #2915
Labels
bug It is confirmed a bug, but don't worry, we'll handle it. done This issue is done, which may be release in next version. help wanted

Comments

@Rehtt
Copy link

Rehtt commented May 25, 2023

1. What version of Go and system type/arch are you using?

go version go1.18.4 windows/amd64

2. What version of GoFrame are you using?

VERSION = "v2.4.1"

3. Can this issue be re-produced with the latest release?

4. What did you do?

	var a struct {
		T time.Time `json:"t"`
	}
	var tmp = map[string]any{"t": "2023-04-15 19:10:00 +0800 CST"}
	err := gconv.Struct(tmp, &a)
	if err != nil {
		panic(err)
	}
	fmt.Println(a)

#  {2023-04-15 19:10:00 +0800 CST}
	var a struct {
		T *time.Time `json:"t"`
	}
	var tmp = map[string]any{"t": "2023-04-15 19:10:00 +0800 CST"}
	err := gconv.Struct(tmp, &a)
	if err != nil {
		panic(err)
	}
	fmt.Println(a)

# panic: error binding value to attribute "T": parsing time "2023-04-15 19:10:00 +0800 CST" as "2006-01-02T15:04:05Z07:00": cannot parse " 19:10:00 +0800 CST" as "T"
	var a struct {
		T *time.Time `json:"t"`
	}
	var tmp = map[string]any{"t": "2006-01-02T15:04:05Z07:00"}
	err := gconv.Struct(tmp, &a)
	if err != nil {
		panic(err)
	}
	fmt.Println(a)

# panic: error binding value to attribute "T": parsing time "2006-01-02T15:04:05Z07:00": extra text: "07:00"

5. What did you expect to see?

6. What did you see instead?

@gqcn gqcn added bug It is confirmed a bug, but don't worry, we'll handle it. help wanted labels Aug 21, 2023
@github-actions
Copy link

Hello @Rehtt. We like your proposal/feedback and would appreciate a contribution via a Pull Request by you or another community member. We thank you in advance for your contribution and are looking forward to reviewing it!
你好 @Rehtt。我们喜欢您的提案/反馈,并希望您或其他社区成员通过拉取请求做出贡献。我们提前感谢您的贡献,并期待对其进行审查。

@gqcn gqcn added the done This issue is done, which may be release in next version. label Sep 4, 2023
@gqcn gqcn closed this as completed in #2915 Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It is confirmed a bug, but don't worry, we'll handle it. done This issue is done, which may be release in next version. help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants