mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-22 06:15:44 +00:00
Merge branch 'fix/filter-po' into 'development'
fix filter See merge request mbugroup/lti-api!548
This commit is contained in:
@@ -2240,6 +2240,11 @@ func (s *purchaseService) attachLatestApprovals(ctx context.Context, items []ent
|
||||
}
|
||||
|
||||
func parsePurchaseDateRangeForQuery(fromStr, toStr, fieldName string) (*time.Time, *time.Time, error) {
|
||||
jakartaLoc, err := time.LoadLocation("Asia/Jakarta")
|
||||
if err != nil {
|
||||
jakartaLoc = time.FixedZone("WIB", 7*60*60)
|
||||
}
|
||||
|
||||
var fromPtr *time.Time
|
||||
var toPtr *time.Time
|
||||
|
||||
@@ -2248,7 +2253,8 @@ func parsePurchaseDateRangeForQuery(fromStr, toStr, fieldName string) (*time.Tim
|
||||
if err != nil {
|
||||
return nil, nil, errors.New(fieldName + "_from must use format YYYY-MM-DD")
|
||||
}
|
||||
fromPtr = &parsed
|
||||
t := time.Date(parsed.Year(), parsed.Month(), parsed.Day(), 0, 0, 0, 0, jakartaLoc)
|
||||
fromPtr = &t
|
||||
}
|
||||
|
||||
if strings.TrimSpace(toStr) != "" {
|
||||
@@ -2256,7 +2262,8 @@ func parsePurchaseDateRangeForQuery(fromStr, toStr, fieldName string) (*time.Tim
|
||||
if err != nil {
|
||||
return nil, nil, errors.New(fieldName + "_to must use format YYYY-MM-DD")
|
||||
}
|
||||
nextDay := parsed.AddDate(0, 0, 1)
|
||||
t := time.Date(parsed.Year(), parsed.Month(), parsed.Day(), 0, 0, 0, 0, jakartaLoc)
|
||||
nextDay := t.AddDate(0, 0, 1)
|
||||
toPtr = &nextDay
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user