mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 08:44:25 +08:00
code refactor
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
package feidee
|
package feidee
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/mayswind/ezbookkeeping/pkg/converters/datatable"
|
"github.com/mayswind/ezbookkeeping/pkg/converters/datatable"
|
||||||
"github.com/mayswind/ezbookkeeping/pkg/errs"
|
"github.com/mayswind/ezbookkeeping/pkg/errs"
|
||||||
"github.com/mayswind/ezbookkeeping/pkg/models"
|
"github.com/mayswind/ezbookkeeping/pkg/models"
|
||||||
@@ -54,23 +52,12 @@ func (p *feideeMymoneyTransactionDataRowParser) getLongDateTime(str string) stri
|
|||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
utcTimezone := time.UTC
|
|
||||||
utcTimezoneOffsetMinutes := utils.GetTimezoneOffsetMinutes(utcTimezone)
|
|
||||||
|
|
||||||
if utils.IsValidLongDateTimeWithoutSecondFormat(str) {
|
if utils.IsValidLongDateTimeWithoutSecondFormat(str) {
|
||||||
dateTime, err := utils.ParseFromLongDateTimeWithoutSecond(str, utcTimezoneOffsetMinutes)
|
return str + ":00"
|
||||||
|
|
||||||
if err == nil {
|
|
||||||
return utils.FormatUnixTimeToLongDateTime(dateTime.Unix(), utcTimezone)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if utils.IsValidLongDateFormat(str) {
|
if utils.IsValidLongDateFormat(str) {
|
||||||
dateTime, err := utils.ParseFromLongDateTimeWithoutSecond(str+" 00:00", utcTimezoneOffsetMinutes)
|
return str + " 00:00:00"
|
||||||
|
|
||||||
if err == nil {
|
|
||||||
return utils.FormatUnixTimeToLongDateTime(dateTime.Unix(), utcTimezone)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
|
|||||||
Reference in New Issue
Block a user