Commit Graph

6 Commits

Author SHA1 Message Date
arturwwl 24a672be3c convert - String2Time accept HH:mm:ss format (#2074)
resolves #2073

Co-authored-by: arturwwl <>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2074
Co-authored-by: arturwwl <arturwwl@noreply.gitea.com>
Co-committed-by: arturwwl <arturwwl@noreply.gitea.com>
2023-07-23 02:34:10 +00:00
Alberto Garcia 94fcec7f65 parse timestamp with milliseconds in tz format (#2246)
This pr fixes a bug caused when a timestmap in TZ format with milliseconds (`2023-04-05T15:50:48.256816Z` or `2023-04-05T15:50:48.256816+08:00`) is being parsed.

- The bug is happens in the function `String2Time` in `convert/time.go`
- if the timestamp contains milliseconds a layout with the structure `2006-01-02 15:04:05.` is used to parse it
- This layout contains an space between the date and the hour, if the timestamp returned by the db contains a `T` the parser fails and an error is returned

This pr adds a check for the `T` and milliseconds in the timestamp, if both conditions are present the date is parsed using the RFC3339 layout

Added test cases to check timestamps in this format

Solves [#2244](https://gitea.com/xorm/xorm/issues/2244)

Reviewed-on: https://gitea.com/xorm/xorm/pulls/2246
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Alberto Garcia <agarcia@circutor.com>
Co-committed-by: Alberto Garcia <agarcia@circutor.com>
2023-04-06 21:47:59 +08:00
jixianlqb 3d1c9fb761 对 DATE格式进行转换 (#2093)
对 DATE格式进行转换

Co-authored-by: laiqiangbin <laiqiangbin@chandashi.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2093
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: jixianlqb <jixianlqb@noreply.gitea.io>
Co-committed-by: jixianlqb <jixianlqb@noreply.gitea.io>
2022-01-16 16:36:07 +08:00
Lunny Xiao cace6862e2 Move convert back to xorm.io/xorm/convert (#2030)
Since `conversion.Conversion` has been referenced by external package, it should not be moved as internal package.

Reviewed-on: https://gitea.com/xorm/xorm/pulls/2030
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-08-10 23:20:53 +08:00
Lunny Xiao 107bee4eb4 refactor conversion (#2001)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2001
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-21 11:46:41 +08:00
Lunny Xiao 8bf97de140 Fix bug on dumptable (#1984)
Fix #1983

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1984
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-11 20:05:43 +08:00