convert - String2Time accept HH:mm:ss format #2074

Merged
lunny merged 2 commits from arturwwl/xorm:time-fix into master 2023-07-23 02:34:16 +00:00
Contributor

resolves #2073

resolves #2073
arturwwl added 1 commit 2021-11-22 15:45:56 +00:00
convert - String2Time accept HH:mm:ss format
All checks were successful
continuous-integration/drone/pr Build is passing
ee13722081
lunny reviewed 2021-11-23 01:54:13 +00:00
convert/time.go Outdated
@ -50,1 +52,4 @@
return &dt, nil
} else if len(s) == 8 && s[2] == ':' && s[5] == ':' {
currentDate := time.Now()
dt, err := time.ParseInLocation("15:04:05", s, originalLocation)
Owner

Why not just use convertedLocation here?

Why not just use `convertedLocation` here?
Author
Contributor

It depends on how it should work.
Does DB time should be always in sync with local time?
For example in location Europe/Warsaw time depends on date Wiki.
Should we expect that something stored in DB (if our DB has UTC time) at 8AM should be in Poland(UTC +1/UTC +2) 9AM/10AM depends on current date?
Also when we consider there is posibility that another go program (on other server) acces to this same DB from other location, I think it is clear it should correctly convert that time to local - example in Asia/Shanghai this should be shown as 4PM.

It depends on how it should work. Does DB time should be always in sync with local time? For example in location `Europe/Warsaw` time depends on date [Wiki](https://en.wikipedia.org/wiki/Time_in_Poland). Should we expect that something stored in DB (if our DB has `UTC` time) at `8AM` should be in Poland(`UTC +1/UTC +2`) `9AM/10AM` depends on current date? Also when we consider there is posibility that another go program (on other server) acces to this same DB from other location, I think it is clear it should correctly convert that time to local - example in `Asia/Shanghai` this should be shown as `4PM`.
Owner

replaced by #2093

replaced by #2093
lunny closed this pull request 2022-01-16 11:05:27 +00:00
Author
Contributor

@lunny how it could be replaced by this PR?
#2093 is date format related (YYYY-mm-dd) not time format related (HH:ii:ss).
It is completely diffirent.

@lunny how it could be replaced by this PR? #2093 is date format related (`YYYY-mm-dd`) not time format related (`HH:ii:ss`). It is completely diffirent.
arturwwl reopened this pull request 2022-03-18 11:08:42 +00:00
Owner

Please resolve the conflict.

Please resolve the conflict.
First-time contributor

any update?

any update?
lunny added 1 commit 2023-07-23 01:24:02 +00:00
Merge branch 'time-fix' of gitea.com:arturwwl/xorm into arturwwl-time-fix
All checks were successful
test mariadb / test mariadb (pull_request) Successful in 4m50s
test cockroach / test cockroach (pull_request) Successful in 7m38s
test mssql / test mssql (pull_request) Successful in 5m44s
test mysql / test mysql (pull_request) Successful in 4m50s
test mysql8 / test mysql8 (pull_request) Successful in 5m12s
test postgres / test postgres (pull_request) Successful in 5m48s
test tidb / test tidb (pull_request) Successful in 5m39s
test sqlite / unit test & test sqlite (pull_request) Successful in 8m45s
e9edbf5b86
lunny approved these changes 2023-07-23 02:33:41 +00:00
lunny merged commit 24a672be3c into master 2023-07-23 02:34:16 +00:00
First-time contributor

ccool

ccool
Sign in to join this conversation.
No description provided.