fix: internal server error because of date parsing

This commit is contained in:
Adnan Zahir
2026-04-21 21:41:54 +07:00
parent 5e7c51e9c2
commit e91c45ee50
5 changed files with 36 additions and 8 deletions
@@ -295,7 +295,7 @@ func (r *PurchaseRepositoryImpl) GetProgressRows(ctx context.Context, startDate,
'Purchases' AS module,
COALESCE(pf_explicit.flock_name, pf_active.flock_name, kandang_loc.name, warehouse_loc.name, 'Unknown Farm') AS farm_name,
COALESCE(k_explicit.name, k_active.name, wk.name, `+unassignedSQL+`, 'Unknown Kandang') AS kandang_name,
DATE(p.po_date) AS activity_date
CAST(DATE(p.po_date) AS TEXT) AS activity_date
`).
Joins("JOIN purchase_items pi ON pi.purchase_id = p.id").
Joins("JOIN warehouses w ON w.id = pi.warehouse_id").
@@ -340,7 +340,7 @@ func (r *PurchaseRepositoryImpl) GetProgressRows(ctx context.Context, startDate,
rows := make([]exportprogress.Row, 0, len(scanned))
for _, item := range scanned {
activityDate, err := time.Parse("2006-01-02", item.ActivityDate)
activityDate, err := exportprogress.ParseActivityDate(item.ActivityDate)
if err != nil {
return nil, err
}