Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

fix: #437 hopefully (#1455)

Matte1aec38ea16e
diff --git a/backend/app/api/demo.go b/backend/app/api/demo.go
index a5888d4f..5899b031 100644
--- a/backend/app/api/demo.go
+++ b/backend/app/api/demo.go
@@ -12,7 +12,7 @@ import (
)
func (a *app) SetupDemo() error {
- csvText := `HB.import_ref,HB.location,HB.tags,HB.quantity,HB.name,HB.description,HB.insured,HB.serial_number,HB.model_number,HB.manufacturer,HB.notes,HB.purchase_from,HB.purchase_price,HB.purchase_time,HB.lifetime_warranty,HB.warranty_expires,HB.warranty_details,HB.sold_to,HB.sold_price,HB.sold_time,HB.sold_notes
+ csvText := `HB.import_ref,HB.location,HB.tags,HB.quantity,HB.name,HB.description,HB.insured,HB.serial_number,HB.model_number,HB.manufacturer,HB.notes,HB.purchase_from,HB.purchase_price,HB.purchase_date,HB.lifetime_warranty,HB.warranty_expires,HB.warranty_details,HB.sold_to,HB.sold_price,HB.sold_date,HB.sold_notes
,Garage,IOT;Home Assistant; Z-Wave,1,Zooz Universal Relay ZEN17,"Zooz 700 Series Z-Wave Universal Relay ZEN17 for Awnings, Garage Doors, Sprinklers, and More | 2 NO-C-NC Relays (20A, 10A) | Signal Repeater | Hub Required (Compatible with SmartThings and Hubitat)",,,ZEN17,Zooz,,Amazon,39.95,10/13/2021,,,,,,,
,Living Room,IOT;Home Assistant; Z-Wave,1,Zooz Motion Sensor,"Zooz Z-Wave Plus S2 Motion Sensor ZSE18 with Magnetic Mount, Works with Vera and SmartThings",,,ZSE18,Zooz,,Amazon,29.95,10/15/2021,,,,,,,
,Office,IOT; Home Assistant; Z-Wave,1,Zooz 110v Power Switch,"Zooz Z-Wave Plus Power Switch ZEN15 for 110V AC Units, Sump Pumps, Humidifiers, and More",,,ZEN15,Zooz,,Amazon,39.95,10/13/2021,,,,,,,
diff --git a/backend/app/api/handlers/v1/v1_ctrl_entities.go b/backend/app/api/handlers/v1/v1_ctrl_entities.go
index 4fce02dc..6758d0a4 100644
--- a/backend/app/api/handlers/v1/v1_ctrl_entities.go
+++ b/backend/app/api/handlers/v1/v1_ctrl_entities.go
@@ -148,7 +148,7 @@ func (ctrl *V1Controller) HandleEntitiesGetAll() errchain.HandlerFunc {
attribute.Int("items.count", len(items.Items)))
totalPrice := new(big.Int)
for _, item := range items.Items {
- if !item.SoldTime.IsZero() {
+ if !item.SoldDate.Time().IsZero() {
continue
}
totalPrice.Add(totalPrice, big.NewInt(int64(math.Round(item.PurchasePrice*100))))
diff --git a/backend/app/api/static/docs/docs.go b/backend/app/api/static/docs/docs.go
index 22773983..046ed44a 100644
--- a/backend/app/api/static/docs/docs.go
+++ b/backend/app/api/static/docs/docs.go
@@ -3074,6 +3074,10 @@ const docTemplate = `{
"description": "Notes holds the value of the \"notes\" field.",
"type": "string"
},
+ "purchase_date": {
+ "description": "PurchaseDate holds the value of the \"purchase_date\" field.",
+ "type": "string"
+ },
"purchase_from": {
"description": "PurchaseFrom holds the value of the \"purchase_from\" field.",
"type": "string"
@@ -3082,10 +3086,6 @@ const docTemplate = `{
"description": "PurchasePrice holds the value of the \"purchase_price\" field.",
"type": "number"
},
- "purchase_time": {
- "description": "PurchaseTime holds the value of the \"purchase_time\" field.",
- "type": "string"
- },
"quantity": {
"description": "Quantity holds the value of the \"quantity\" field.",
"type": "number"
@@ -3094,6 +3094,10 @@ const docTemplate = `{
"description": "SerialNumber holds the value of the \"serial_number\" field.",
"type": "string"
},
+ "sold_date": {
+ "description": "SoldDate holds the value of the \"sold_date\" field.",
+ "type": "string"
+ },
"sold_notes": {
"description": "SoldNotes holds the value of the \"sold_notes\" field.",
"type": "string"
@@ -3102,10 +3106,6 @@ const docTemplate = `{
"description": "SoldPrice holds the value of the \"sold_price\" field.",
"type": "number"
},
- "sold_time": {
- "description": "SoldTime holds the value of the \"sold_time\" field.",
- "type": "string"
- },
"sold_to": {
"description": "SoldTo holds the value of the \"sold_to\" field.",
"type": "string"
@@ -4182,32 +4182,32 @@ const docTemplate = `{
"x-nullable": true,
"x-omitempty": true
},
+ "purchaseDate": {
+ "description": "Purchase",
+ "type": "string"
+ },
"purchaseFrom": {
"type": "string"
},
"purchasePrice": {
"type": "number"
},
- "purchaseTime": {
- "description": "Purchase",
- "type": "string"
- },
"quantity": {
"type": "number"
},
"serialNumber": {
"type": "string"
},
+ "soldDate": {
+ "description": "Sold",
+ "type": "string"
+ },
"soldNotes": {
"type": "string"
},
"soldPrice": {
"type": "number"
},
- "soldTime": {
- "description": "Sold",
- "type": "string"
- },
"soldTo": {
"type": "string"
},
@@ -4354,7 +4354,7 @@ const docTemplate = `{
"quantity": {
"type": "number"
},
- "soldTime": {
+ "soldDate": {
"description": "Sale details",
"type": "string"
},
@@ -4772,6 +4772,10 @@ const docTemplate = `{
"x-nullable": true,
"x-omitempty": true
},
+ "purchaseDate": {
+ "description": "Purchase",
+ "type": "string"
+ },
"purchaseFrom": {
"type": "string",
"maxLength": 255
@@ -4781,10 +4785,6 @@ const docTemplate = `{
"x-nullable": true,
"x-omitempty": true
},
- "purchaseTime": {
- "description": "Purchase",
- "type": "string"
- },
"quantity": {
"type": "number"
},
@@ -4792,6 +4792,10 @@ const docTemplate = `{
"description": "Identifications",
"type": "string"
},
+ "soldDate": {
+ "description": "Sold",
+ "type": "string"
+ },
"soldNotes": {
"type": "string"
},
@@ -4800,10 +4804,6 @@ const docTemplate = `{
"x-nullable": true,
"x-omitempty": true
},
- "soldTime": {
- "description": "Sold",
- "type": "string"
- },
"soldTo": {
"type": "string",
"maxLength": 255
diff --git a/backend/app/api/static/docs/openapi-3.json b/backend/app/api/static/docs/openapi-3.json
index 4184b023..bf4b6ed1 100644
--- a/backend/app/api/static/docs/openapi-3.json
+++ b/backend/app/api/static/docs/openapi-3.json
@@ -3268,6 +3268,10 @@
"description": "Notes holds the value of the \"notes\" field.",
"type": "string"
},
+ "purchase_date": {
+ "description": "PurchaseDate holds the value of the \"purchase_date\" field.",
+ "type": "string"
+ },
"purchase_from": {
"description": "PurchaseFrom holds the value of the \"purchase_from\" field.",
"type": "string"
@@ -3276,10 +3280,6 @@
"description": "PurchasePrice holds the value of the \"purchase_price\" field.",
"type": "number"
},
- "purchase_time": {
- "description": "PurchaseTime holds the value of the \"purchase_time\" field.",
- "type": "string"
- },
"quantity": {
"description": "Quantity holds the value of the \"quantity\" field.",
"type": "number"
@@ -3288,6 +3288,10 @@
"description": "SerialNumber holds the value of the \"serial_number\" field.",
"type": "string"
},
+ "sold_date": {
+ "description": "SoldDate holds the value of the \"sold_date\" field.",
+ "type": "string"
+ },
"sold_notes": {
"description": "SoldNotes holds the value of the \"sold_notes\" field.",
"type": "string"
@@ -3296,10 +3300,6 @@
"description": "SoldPrice holds the value of the \"sold_price\" field.",
"type": "number"
},
- "sold_time": {
- "description": "SoldTime holds the value of the \"sold_time\" field.",
- "type": "string"
- },
"sold_to": {
"description": "SoldTo holds the value of the \"sold_to\" field.",
"type": "string"
@@ -4376,32 +4376,32 @@
"x-omitempty": true,
"nullable": true
},
+ "purchaseDate": {
+ "description": "Purchase",
+ "type": "string"
+ },
"purchaseFrom": {
"type": "string"
},
"purchasePrice": {
"type": "number"
},
- "purchaseTime": {
- "description": "Purchase",
- "type": "string"
- },
"quantity": {
"type": "number"
},
"serialNumber": {
"type": "string"
},
+ "soldDate": {
+ "description": "Sold",
+ "type": "string"
+ },
"soldNotes": {
"type": "string"
},
"soldPrice": {
"type": "number"
},
- "soldTime": {
- "description": "Sold",
- "type": "string"
- },
"soldTo": {
"type": "string"
},
@@ -4548,7 +4548,7 @@
"quantity": {
"type": "number"
},
- "soldTime": {
+ "soldDate": {
"description": "Sale details",
"type": "string"
},
@@ -4966,6 +4966,10 @@
"x-omitempty": true,
"nullable": true
},
+ "purchaseDate": {
+ "description": "Purchase",
+ "type": "string"
+ },
"purchaseFrom": {
"type": "string",
"maxLength": 255
@@ -4975,10 +4979,6 @@
"x-omitempty": true,
"nullable": true
},
- "purchaseTime": {
- "description": "Purchase",
- "type": "string"
- },
"quantity": {
"type": "number"
},
@@ -4986,6 +4986,10 @@
"description": "Identifications",
"type": "string"
},
+ "soldDate": {
+ "description": "Sold",
+ "type": "string"
+ },
"soldNotes": {
"type": "string"
},
@@ -4994,10 +4998,6 @@
"x-omitempty": true,
"nullable": true
},
- "soldTime": {
- "description": "Sold",
- "type": "string"
- },
"soldTo": {
"type": "string",
"maxLength": 255
diff --git a/backend/app/api/static/docs/openapi-3.yaml b/backend/app/api/static/docs/openapi-3.yaml
index 300e66e8..5a1b846d 100644
--- a/backend/app/api/static/docs/openapi-3.yaml
+++ b/backend/app/api/static/docs/openapi-3.yaml
@@ -1962,30 +1962,30 @@ components:
notes:
description: Notes holds the value of the "notes" field.
type: string
+ purchase_date:
+ description: PurchaseDate holds the value of the "purchase_date" field.
+ type: string
purchase_from:
description: PurchaseFrom holds the value of the "purchase_from" field.
type: string
purchase_price:
description: PurchasePrice holds the value of the "purchase_price" field.
type: number
- purchase_time:
- description: PurchaseTime holds the value of the "purchase_time" field.
- type: string
quantity:
description: Quantity holds the value of the "quantity" field.
type: number
serial_number:
description: SerialNumber holds the value of the "serial_number" field.
type: string
+ sold_date:
+ description: SoldDate holds the value of the "sold_date" field.
+ type: string
sold_notes:
description: SoldNotes holds the value of the "sold_notes" field.
type: string
sold_price:
description: SoldPrice holds the value of the "sold_price" field.
type: number
- sold_time:
- description: SoldTime holds the value of the "sold_time" field.
- type: string
sold_to:
description: SoldTo holds the value of the "sold_to" field.
type: string
@@ -2737,24 +2737,24 @@ components:
- $ref: "#/components/schemas/repo.EntitySummary"
x-omitempty: true
nullable: true
+ purchaseDate:
+ description: Purchase
+ type: string
purchaseFrom:
type: string
purchasePrice:
type: number
- purchaseTime:
- description: Purchase
- type: string
quantity:
type: number
serialNumber:
type: string
+ soldDate:
+ description: Sold
+ type: string
soldNotes:
type: string
soldPrice:
type: number
- soldTime:
- description: Sold
- type: string
soldTo:
type: string
syncChildEntityLocations:
@@ -2855,7 +2855,7 @@ components:
type: number
quantity:
type: number
- soldTime:
+ soldDate:
description: Sale details
type: string
tags:
@@ -3148,6 +3148,9 @@ components:
type: string
x-omitempty: true
nullable: true
+ purchaseDate:
+ description: Purchase
+ type: string
purchaseFrom:
type: string
maxLength: 255
@@ -3155,23 +3158,20 @@ components:
type: number
x-omitempty: true
nullable: true
- purchaseTime:
- description: Purchase
- type: string
quantity:
type: number
serialNumber:
description: Identifications
type: string
+ soldDate:
+ description: Sold
+ type: string
soldNotes:
type: string
soldPrice:
type: number
x-omitempty: true
nullable: true
- soldTime:
- description: Sold
- type: string
soldTo:
type: string
maxLength: 255
diff --git a/backend/app/api/static/docs/swagger.json b/backend/app/api/static/docs/swagger.json
index 8053cb1b..f9c9bd75 100644
--- a/backend/app/api/static/docs/swagger.json
+++ b/backend/app/api/static/docs/swagger.json
@@ -3071,6 +3071,10 @@
"description": "Notes holds the value of the \"notes\" field.",
"type": "string"
},
+ "purchase_date": {
+ "description": "PurchaseDate holds the value of the \"purchase_date\" field.",
+ "type": "string"
+ },
"purchase_from": {
"description": "PurchaseFrom holds the value of the \"purchase_from\" field.",
"type": "string"
@@ -3079,10 +3083,6 @@
"description": "PurchasePrice holds the value of the \"purchase_price\" field.",
"type": "number"
},
- "purchase_time": {
- "description": "PurchaseTime holds the value of the \"purchase_time\" field.",
- "type": "string"
- },
"quantity": {
"description": "Quantity holds the value of the \"quantity\" field.",
"type": "number"
@@ -3091,6 +3091,10 @@
"description": "SerialNumber holds the value of the \"serial_number\" field.",
"type": "string"
},
+ "sold_date": {
+ "description": "SoldDate holds the value of the \"sold_date\" field.",
+ "type": "string"
+ },
"sold_notes": {
"description": "SoldNotes holds the value of the \"sold_notes\" field.",
"type": "string"
@@ -3099,10 +3103,6 @@
"description": "SoldPrice holds the value of the \"sold_price\" field.",
"type": "number"
},
- "sold_time": {
- "description": "SoldTime holds the value of the \"sold_time\" field.",
- "type": "string"
- },
"sold_to": {
"description": "SoldTo holds the value of the \"sold_to\" field.",
"type": "string"
@@ -4179,32 +4179,32 @@
"x-nullable": true,
"x-omitempty": true
},
+ "purchaseDate": {
+ "description": "Purchase",
+ "type": "string"
+ },
"purchaseFrom": {
"type": "string"
},
"purchasePrice": {
"type": "number"
},
- "purchaseTime": {
- "description": "Purchase",
- "type": "string"
- },
"quantity": {
"type": "number"
},
"serialNumber": {
"type": "string"
},
+ "soldDate": {
+ "description": "Sold",
+ "type": "string"
+ },
"soldNotes": {
"type": "string"
},
"soldPrice": {
"type": "number"
},
- "soldTime": {
- "description": "Sold",
- "type": "string"
- },
"soldTo": {
"type": "string"
},
@@ -4351,7 +4351,7 @@
"quantity": {
"type": "number"
},
- "soldTime": {
+ "soldDate": {
"description": "Sale details",
"type": "string"
},
@@ -4769,6 +4769,10 @@
"x-nullable": true,
"x-omitempty": true
},
+ "purchaseDate": {
+ "description": "Purchase",
+ "type": "string"
+ },
"purchaseFrom": {
"type": "string",
"maxLength": 255
@@ -4778,10 +4782,6 @@
"x-nullable": true,
"x-omitempty": true
},
- "purchaseTime": {
- "description": "Purchase",
- "type": "string"
- },
"quantity": {
"type": "number"
},
@@ -4789,6 +4789,10 @@
"description": "Identifications",
"type": "string"
},
+ "soldDate": {
+ "description": "Sold",
+ "type": "string"
+ },
"soldNotes": {
"type": "string"
},
@@ -4797,10 +4801,6 @@
"x-nullable": true,
"x-omitempty": true
},
- "soldTime": {
- "description": "Sold",
- "type": "string"
- },
"soldTo": {
"type": "string",
"maxLength": 255
diff --git a/backend/app/api/static/docs/swagger.yaml b/backend/app/api/static/docs/swagger.yaml
index 3dfec4d3..dfca1378 100644
--- a/backend/app/api/static/docs/swagger.yaml
+++ b/backend/app/api/static/docs/swagger.yaml
@@ -192,30 +192,30 @@ definitions:
notes:
description: Notes holds the value of the "notes" field.
type: string
+ purchase_date:
+ description: PurchaseDate holds the value of the "purchase_date" field.
+ type: string
purchase_from:
description: PurchaseFrom holds the value of the "purchase_from" field.
type: string
purchase_price:
description: PurchasePrice holds the value of the "purchase_price" field.
type: number
- purchase_time:
- description: PurchaseTime holds the value of the "purchase_time" field.
- type: string
quantity:
description: Quantity holds the value of the "quantity" field.
type: number
serial_number:
description: SerialNumber holds the value of the "serial_number" field.
type: string
+ sold_date:
+ description: SoldDate holds the value of the "sold_date" field.
+ type: string
sold_notes:
description: SoldNotes holds the value of the "sold_notes" field.
type: string
sold_price:
description: SoldPrice holds the value of the "sold_price" field.
type: number
- sold_time:
- description: SoldTime holds the value of the "sold_time" field.
- type: string
sold_to:
description: SoldTo holds the value of the "sold_to" field.
type: string
@@ -958,24 +958,24 @@ definitions:
description: Edges
x-nullable: true
x-omitempty: true
+ purchaseDate:
+ description: Purchase
+ type: string
purchaseFrom:
type: string
purchasePrice:
type: number
- purchaseTime:
- description: Purchase
- type: string
quantity:
type: number
serialNumber:
type: string
+ soldDate:
+ description: Sold
+ type: string
soldNotes:
type: string
soldPrice:
type: number
- soldTime:
- description: Sold
- type: string
soldTo:
type: string
syncChildEntityLocations:
@@ -1076,7 +1076,7 @@ definitions:
type: number
quantity:
type: number
- soldTime:
+ soldDate:
description: Sale details
type: string
tags:
@@ -1367,6 +1367,9 @@ definitions:
type: string
x-nullable: true
x-omitempty: true
+ purchaseDate:
+ description: Purchase
+ type: string
purchaseFrom:
maxLength: 255
type: string
@@ -1374,23 +1377,20 @@ definitions:
type: number
x-nullable: true
x-omitempty: true
- purchaseTime:
- description: Purchase
- type: string
quantity:
type: number
serialNumber:
description: Identifications
type: string
+ soldDate:
+ description: Sold
+ type: string
soldNotes:
type: string
soldPrice:
type: number
x-nullable: true
x-omitempty: true
- soldTime:
- description: Sold
- type: string
soldTo:
maxLength: 255
type: string
diff --git a/backend/app/tools/typegen/main.go b/backend/app/tools/typegen/main.go
index 5f4d8dad..0a880483 100644
--- a/backend/app/tools/typegen/main.go
+++ b/backend/app/tools/typegen/main.go
@@ -57,8 +57,8 @@ func main() {
NewReReplace(`(\w+):\s(.*null.*)`, "$1?: $2"), // make null union types optional
NewReDate("createdAt"),
NewReDate("updatedAt"),
- NewReDate("soldTime"),
- NewReDate("purchaseTime"),
+ NewReDate("soldDate"),
+ NewReDate("purchaseDate"),
NewReDate("warrantyExpires"),
NewReDate("expiresAt"),
NewReDate("date"),
diff --git a/backend/internal/core/services/reporting/bill_of_materials.go b/backend/internal/core/services/reporting/bill_of_materials.go
index 8a8b6eff..050559e5 100644
--- a/backend/internal/core/services/reporting/bill_of_materials.go
+++ b/backend/internal/core/services/reporting/bill_of_materials.go
@@ -26,7 +26,7 @@ type BillOfMaterialsEntry struct {
func BillOfMaterialsCSV(entities []repo.EntityOut) ([]byte, error) {
return gocsv.MarshalBytes(new(lo.Map(entities, func(entity repo.EntityOut, _ int) BillOfMaterialsEntry {
return BillOfMaterialsEntry{
- PurchaseDate: entity.PurchaseTime,
+ PurchaseDate: entity.PurchaseDate,
Name: entity.Name,
Description: entity.Description,
Manufacturer: entity.Manufacturer,
diff --git a/backend/internal/core/services/reporting/io_row.go b/backend/internal/core/services/reporting/io_row.go
index 8c2a5159..83137570 100644
--- a/backend/internal/core/services/reporting/io_row.go
+++ b/backend/internal/core/services/reporting/io_row.go
@@ -29,7 +29,7 @@ type ExportCSVRow struct {
PurchasePrice float64 `csv:"HB.purchase_price"`
PurchaseFrom string `csv:"HB.purchase_from"`
- PurchaseTime types.Date `csv:"HB.purchase_time"`
+ PurchaseDate types.Date `csv:"HB.purchase_date|HB.purchase_time"`
Manufacturer string `csv:"HB.manufacturer"`
ModelNumber string `csv:"HB.model_number"`
@@ -41,7 +41,7 @@ type ExportCSVRow struct {
SoldTo string `csv:"HB.sold_to"`
SoldPrice float64 `csv:"HB.sold_price"`
- SoldTime types.Date `csv:"HB.sold_time"`
+ SoldDate types.Date `csv:"HB.sold_date|HB.sold_time"`
SoldNotes string `csv:"HB.sold_notes"`
Fields []ExportItemFields `csv:"-"`
diff --git a/backend/internal/core/services/reporting/io_sheet.go b/backend/internal/core/services/reporting/io_sheet.go
index 699f2f17..b5365466 100644
--- a/backend/internal/core/services/reporting/io_sheet.go
+++ b/backend/internal/core/services/reporting/io_sheet.go
@@ -251,7 +251,7 @@ func (s *IOSheet) ReadItems(ctx context.Context, entities []repo.EntityOut, gid
PurchasePrice: item.PurchasePrice,
PurchaseFrom: item.PurchaseFrom,
- PurchaseTime: item.PurchaseTime,
+ PurchaseDate: item.PurchaseDate,
Manufacturer: item.Manufacturer,
ModelNumber: item.ModelNumber,
@@ -262,7 +262,7 @@ func (s *IOSheet) ReadItems(ctx context.Context, entities []repo.EntityOut, gid
WarrantyDetails: item.WarrantyDetails,
SoldTo: item.SoldTo,
- SoldTime: item.SoldTime,
+ SoldDate: item.SoldDate,
SoldPrice: item.SoldPrice,
SoldNotes: item.SoldNotes,
diff --git a/backend/internal/core/services/service_entities.go b/backend/internal/core/services/service_entities.go
index 8915df53..6734f7b1 100644
--- a/backend/internal/core/services/service_entities.go
+++ b/backend/internal/core/services/service_entities.go
@@ -470,7 +470,7 @@ func (svc *EntityService) CsvImport(ctx context.Context, gid uuid.UUID, data io.
PurchasePrice: row.PurchasePrice,
PurchaseFrom: row.PurchaseFrom,
- PurchaseTime: row.PurchaseTime,
+ PurchaseDate: row.PurchaseDate,
Manufacturer: row.Manufacturer,
ModelNumber: row.ModelNumber,
@@ -481,7 +481,7 @@ func (svc *EntityService) CsvImport(ctx context.Context, gid uuid.UUID, data io.
WarrantyDetails: row.WarrantyDetails,
SoldTo: row.SoldTo,
- SoldTime: row.SoldTime,
+ SoldDate: row.SoldDate,
SoldPrice: row.SoldPrice,
SoldNotes: row.SoldNotes,
diff --git a/backend/internal/data/ent/entity.go b/backend/internal/data/ent/entity.go
index b3260f33..7de03133 100644
--- a/backend/internal/data/ent/entity.go
+++ b/backend/internal/data/ent/entity.go
@@ -54,14 +54,14 @@ type Entity struct {
WarrantyExpires time.Time `json:"warranty_expires,omitempty"`
// WarrantyDetails holds the value of the "warranty_details" field.
WarrantyDetails string `json:"warranty_details,omitempty"`
- // PurchaseTime holds the value of the "purchase_time" field.
- PurchaseTime time.Time `json:"purchase_time,omitempty"`
+ // PurchaseDate holds the value of the "purchase_date" field.
+ PurchaseDate time.Time `json:"purchase_date,omitempty"`
// PurchaseFrom holds the value of the "purchase_from" field.
PurchaseFrom string `json:"purchase_from,omitempty"`
// PurchasePrice holds the value of the "purchase_price" field.
PurchasePrice float64 `json:"purchase_price,omitempty"`
- // SoldTime holds the value of the "sold_time" field.
- SoldTime time.Time `json:"sold_time,omitempty"`
+ // SoldDate holds the value of the "sold_date" field.
+ SoldDate time.Time `json:"sold_date,omitempty"`
// SoldTo holds the value of the "sold_to" field.
SoldTo string `json:"sold_to,omitempty"`
// SoldPrice holds the value of the "sold_price" field.
@@ -191,7 +191,7 @@ func (*Entity) scanValues(columns []string) ([]any, error) {
values[i] = new(sql.NullInt64)
case entity.FieldName, entity.FieldDescription, entity.FieldImportRef, entity.FieldNotes, entity.FieldSerialNumber, entity.FieldModelNumber, entity.FieldManufacturer, entity.FieldWarrantyDetails, entity.FieldPurchaseFrom, entity.FieldSoldTo, entity.FieldSoldNotes:
values[i] = new(sql.NullString)
- case entity.FieldCreatedAt, entity.FieldUpdatedAt, entity.FieldWarrantyExpires, entity.FieldPurchaseTime, entity.FieldSoldTime:
+ case entity.FieldCreatedAt, entity.FieldUpdatedAt, entity.FieldWarrantyExpires, entity.FieldPurchaseDate, entity.FieldSoldDate:
values[i] = new(sql.NullTime)
case entity.FieldID:
values[i] = new(uuid.UUID)
@@ -324,11 +324,11 @@ func (_m *Entity) assignValues(columns []string, values []any) error {
} else if value.Valid {
_m.WarrantyDetails = value.String
}
- case entity.FieldPurchaseTime:
+ case entity.FieldPurchaseDate:
if value, ok := values[i].(*sql.NullTime); !ok {
- return fmt.Errorf("unexpected type %T for field purchase_time", values[i])
+ return fmt.Errorf("unexpected type %T for field purchase_date", values[i])
} else if value.Valid {
- _m.PurchaseTime = value.Time
+ _m.PurchaseDate = value.Time
}
case entity.FieldPurchaseFrom:
if value, ok := values[i].(*sql.NullString); !ok {
@@ -342,11 +342,11 @@ func (_m *Entity) assignValues(columns []string, values []any) error {
} else if value.Valid {
_m.PurchasePrice = value.Float64
}
- case entity.FieldSoldTime:
+ case entity.FieldSoldDate:
if value, ok := values[i].(*sql.NullTime); !ok {
- return fmt.Errorf("unexpected type %T for field sold_time", values[i])
+ return fmt.Errorf("unexpected type %T for field sold_date", values[i])
} else if value.Valid {
- _m.SoldTime = value.Time
+ _m.SoldDate = value.Time
}
case entity.FieldSoldTo:
if value, ok := values[i].(*sql.NullString); !ok {
@@ -514,8 +514,8 @@ func (_m *Entity) String() string {
builder.WriteString("warranty_details=")
builder.WriteString(_m.WarrantyDetails)
builder.WriteString(", ")
- builder.WriteString("purchase_time=")
- builder.WriteString(_m.PurchaseTime.Format(time.ANSIC))
+ builder.WriteString("purchase_date=")
+ builder.WriteString(_m.PurchaseDate.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("purchase_from=")
builder.WriteString(_m.PurchaseFrom)
@@ -523,8 +523,8 @@ func (_m *Entity) String() string {
builder.WriteString("purchase_price=")
builder.WriteString(fmt.Sprintf("%v", _m.PurchasePrice))
builder.WriteString(", ")
- builder.WriteString("sold_time=")
- builder.WriteString(_m.SoldTime.Format(time.ANSIC))
+ builder.WriteString("sold_date=")
+ builder.WriteString(_m.SoldDate.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("sold_to=")
builder.WriteString(_m.SoldTo)
diff --git a/backend/internal/data/ent/entity/entity.go b/backend/internal/data/ent/entity/entity.go
index 1959a731..86695dcb 100644
--- a/backend/internal/data/ent/entity/entity.go
+++ b/backend/internal/data/ent/entity/entity.go
@@ -49,14 +49,14 @@ const (
FieldWarrantyExpires = "warranty_expires"
// FieldWarrantyDetails holds the string denoting the warranty_details field in the database.
FieldWarrantyDetails = "warranty_details"
- // FieldPurchaseTime holds the string denoting the purchase_time field in the database.
- FieldPurchaseTime = "purchase_time"
+ // FieldPurchaseDate holds the string denoting the purchase_date field in the database.
+ FieldPurchaseDate = "purchase_date"
// FieldPurchaseFrom holds the string denoting the purchase_from field in the database.
FieldPurchaseFrom = "purchase_from"
// FieldPurchasePrice holds the string denoting the purchase_price field in the database.
FieldPurchasePrice = "purchase_price"
- // FieldSoldTime holds the string denoting the sold_time field in the database.
- FieldSoldTime = "sold_time"
+ // FieldSoldDate holds the string denoting the sold_date field in the database.
+ FieldSoldDate = "sold_date"
// FieldSoldTo holds the string denoting the sold_to field in the database.
FieldSoldTo = "sold_to"
// FieldSoldPrice holds the string denoting the sold_price field in the database.
@@ -151,10 +151,10 @@ var Columns = []string{
FieldLifetimeWarranty,
FieldWarrantyExpires,
FieldWarrantyDetails,
- FieldPurchaseTime,
+ FieldPurchaseDate,
FieldPurchaseFrom,
FieldPurchasePrice,
- FieldSoldTime,
+ FieldSoldDate,
FieldSoldTo,
FieldSoldPrice,
FieldSoldNotes,
@@ -327,9 +327,9 @@ func ByWarrantyDetails(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldWarrantyDetails, opts...).ToFunc()
}
-// ByPurchaseTime orders the results by the purchase_time field.
-func ByPurchaseTime(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldPurchaseTime, opts...).ToFunc()
+// ByPurchaseDate orders the results by the purchase_date field.
+func ByPurchaseDate(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldPurchaseDate, opts...).ToFunc()
}
// ByPurchaseFrom orders the results by the purchase_from field.
@@ -342,9 +342,9 @@ func ByPurchasePrice(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPurchasePrice, opts...).ToFunc()
}
-// BySoldTime orders the results by the sold_time field.
-func BySoldTime(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldSoldTime, opts...).ToFunc()
+// BySoldDate orders the results by the sold_date field.
+func BySoldDate(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldSoldDate, opts...).ToFunc()
}
// BySoldTo orders the results by the sold_to field.
diff --git a/backend/internal/data/ent/entity/where.go b/backend/internal/data/ent/entity/where.go
index 0dfde99e..2115f63f 100644
--- a/backend/internal/data/ent/entity/where.go
+++ b/backend/internal/data/ent/entity/where.go
@@ -141,9 +141,9 @@ func WarrantyDetails(v string) predicate.Entity {
return predicate.Entity(sql.FieldEQ(FieldWarrantyDetails, v))
}
-// PurchaseTime applies equality check predicate on the "purchase_time" field. It's identical to PurchaseTimeEQ.
-func PurchaseTime(v time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldEQ(FieldPurchaseTime, v))
+// PurchaseDate applies equality check predicate on the "purchase_date" field. It's identical to PurchaseDateEQ.
+func PurchaseDate(v time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldEQ(FieldPurchaseDate, v))
}
// PurchaseFrom applies equality check predicate on the "purchase_from" field. It's identical to PurchaseFromEQ.
@@ -156,9 +156,9 @@ func PurchasePrice(v float64) predicate.Entity {
return predicate.Entity(sql.FieldEQ(FieldPurchasePrice, v))
}
-// SoldTime applies equality check predicate on the "sold_time" field. It's identical to SoldTimeEQ.
-func SoldTime(v time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldEQ(FieldSoldTime, v))
+// SoldDate applies equality check predicate on the "sold_date" field. It's identical to SoldDateEQ.
+func SoldDate(v time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldEQ(FieldSoldDate, v))
}
// SoldTo applies equality check predicate on the "sold_to" field. It's identical to SoldToEQ.
@@ -1016,54 +1016,54 @@ func WarrantyDetailsContainsFold(v string) predicate.Entity {
return predicate.Entity(sql.FieldContainsFold(FieldWarrantyDetails, v))
}
-// PurchaseTimeEQ applies the EQ predicate on the "purchase_time" field.
-func PurchaseTimeEQ(v time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldEQ(FieldPurchaseTime, v))
+// PurchaseDateEQ applies the EQ predicate on the "purchase_date" field.
+func PurchaseDateEQ(v time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldEQ(FieldPurchaseDate, v))
}
-// PurchaseTimeNEQ applies the NEQ predicate on the "purchase_time" field.
-func PurchaseTimeNEQ(v time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldNEQ(FieldPurchaseTime, v))
+// PurchaseDateNEQ applies the NEQ predicate on the "purchase_date" field.
+func PurchaseDateNEQ(v time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldNEQ(FieldPurchaseDate, v))
}
-// PurchaseTimeIn applies the In predicate on the "purchase_time" field.
-func PurchaseTimeIn(vs ...time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldIn(FieldPurchaseTime, vs...))
+// PurchaseDateIn applies the In predicate on the "purchase_date" field.
+func PurchaseDateIn(vs ...time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldIn(FieldPurchaseDate, vs...))
}
-// PurchaseTimeNotIn applies the NotIn predicate on the "purchase_time" field.
-func PurchaseTimeNotIn(vs ...time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldNotIn(FieldPurchaseTime, vs...))
+// PurchaseDateNotIn applies the NotIn predicate on the "purchase_date" field.
+func PurchaseDateNotIn(vs ...time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldNotIn(FieldPurchaseDate, vs...))
}
-// PurchaseTimeGT applies the GT predicate on the "purchase_time" field.
-func PurchaseTimeGT(v time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldGT(FieldPurchaseTime, v))
+// PurchaseDateGT applies the GT predicate on the "purchase_date" field.
+func PurchaseDateGT(v time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldGT(FieldPurchaseDate, v))
}
-// PurchaseTimeGTE applies the GTE predicate on the "purchase_time" field.
-func PurchaseTimeGTE(v time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldGTE(FieldPurchaseTime, v))
+// PurchaseDateGTE applies the GTE predicate on the "purchase_date" field.
+func PurchaseDateGTE(v time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldGTE(FieldPurchaseDate, v))
}
-// PurchaseTimeLT applies the LT predicate on the "purchase_time" field.
-func PurchaseTimeLT(v time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldLT(FieldPurchaseTime, v))
+// PurchaseDateLT applies the LT predicate on the "purchase_date" field.
+func PurchaseDateLT(v time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldLT(FieldPurchaseDate, v))
}
-// PurchaseTimeLTE applies the LTE predicate on the "purchase_time" field.
-func PurchaseTimeLTE(v time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldLTE(FieldPurchaseTime, v))
+// PurchaseDateLTE applies the LTE predicate on the "purchase_date" field.
+func PurchaseDateLTE(v time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldLTE(FieldPurchaseDate, v))
}
-// PurchaseTimeIsNil applies the IsNil predicate on the "purchase_time" field.
-func PurchaseTimeIsNil() predicate.Entity {
- return predicate.Entity(sql.FieldIsNull(FieldPurchaseTime))
+// PurchaseDateIsNil applies the IsNil predicate on the "purchase_date" field.
+func PurchaseDateIsNil() predicate.Entity {
+ return predicate.Entity(sql.FieldIsNull(FieldPurchaseDate))
}
-// PurchaseTimeNotNil applies the NotNil predicate on the "purchase_time" field.
-func PurchaseTimeNotNil() predicate.Entity {
- return predicate.Entity(sql.FieldNotNull(FieldPurchaseTime))
+// PurchaseDateNotNil applies the NotNil predicate on the "purchase_date" field.
+func PurchaseDateNotNil() predicate.Entity {
+ return predicate.Entity(sql.FieldNotNull(FieldPurchaseDate))
}
// PurchaseFromEQ applies the EQ predicate on the "purchase_from" field.
@@ -1181,54 +1181,54 @@ func PurchasePriceLTE(v float64) predicate.Entity {
return predicate.Entity(sql.FieldLTE(FieldPurchasePrice, v))
}
-// SoldTimeEQ applies the EQ predicate on the "sold_time" field.
-func SoldTimeEQ(v time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldEQ(FieldSoldTime, v))
+// SoldDateEQ applies the EQ predicate on the "sold_date" field.
+func SoldDateEQ(v time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldEQ(FieldSoldDate, v))
}
-// SoldTimeNEQ applies the NEQ predicate on the "sold_time" field.
-func SoldTimeNEQ(v time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldNEQ(FieldSoldTime, v))
+// SoldDateNEQ applies the NEQ predicate on the "sold_date" field.
+func SoldDateNEQ(v time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldNEQ(FieldSoldDate, v))
}
-// SoldTimeIn applies the In predicate on the "sold_time" field.
-func SoldTimeIn(vs ...time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldIn(FieldSoldTime, vs...))
+// SoldDateIn applies the In predicate on the "sold_date" field.
+func SoldDateIn(vs ...time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldIn(FieldSoldDate, vs...))
}
-// SoldTimeNotIn applies the NotIn predicate on the "sold_time" field.
-func SoldTimeNotIn(vs ...time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldNotIn(FieldSoldTime, vs...))
+// SoldDateNotIn applies the NotIn predicate on the "sold_date" field.
+func SoldDateNotIn(vs ...time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldNotIn(FieldSoldDate, vs...))
}
-// SoldTimeGT applies the GT predicate on the "sold_time" field.
-func SoldTimeGT(v time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldGT(FieldSoldTime, v))
+// SoldDateGT applies the GT predicate on the "sold_date" field.
+func SoldDateGT(v time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldGT(FieldSoldDate, v))
}
-// SoldTimeGTE applies the GTE predicate on the "sold_time" field.
-func SoldTimeGTE(v time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldGTE(FieldSoldTime, v))
+// SoldDateGTE applies the GTE predicate on the "sold_date" field.
+func SoldDateGTE(v time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldGTE(FieldSoldDate, v))
}
-// SoldTimeLT applies the LT predicate on the "sold_time" field.
-func SoldTimeLT(v time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldLT(FieldSoldTime, v))
+// SoldDateLT applies the LT predicate on the "sold_date" field.
+func SoldDateLT(v time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldLT(FieldSoldDate, v))
}
-// SoldTimeLTE applies the LTE predicate on the "sold_time" field.
-func SoldTimeLTE(v time.Time) predicate.Entity {
- return predicate.Entity(sql.FieldLTE(FieldSoldTime, v))
+// SoldDateLTE applies the LTE predicate on the "sold_date" field.
+func SoldDateLTE(v time.Time) predicate.Entity {
+ return predicate.Entity(sql.FieldLTE(FieldSoldDate, v))
}
-// SoldTimeIsNil applies the IsNil predicate on the "sold_time" field.
-func SoldTimeIsNil() predicate.Entity {
- return predicate.Entity(sql.FieldIsNull(FieldSoldTime))
+// SoldDateIsNil applies the IsNil predicate on the "sold_date" field.
+func SoldDateIsNil() predicate.Entity {
+ return predicate.Entity(sql.FieldIsNull(FieldSoldDate))
}
-// SoldTimeNotNil applies the NotNil predicate on the "sold_time" field.
-func SoldTimeNotNil() predicate.Entity {
- return predicate.Entity(sql.FieldNotNull(FieldSoldTime))
+// SoldDateNotNil applies the NotNil predicate on the "sold_date" field.
+func SoldDateNotNil() predicate.Entity {
+ return predicate.Entity(sql.FieldNotNull(FieldSoldDate))
}
// SoldToEQ applies the EQ predicate on the "sold_to" field.
diff --git a/backend/internal/data/ent/entity_create.go b/backend/internal/data/ent/entity_create.go
index ba2e4ce6..fdf2917b 100644
--- a/backend/internal/data/ent/entity_create.go
+++ b/backend/internal/data/ent/entity_create.go
@@ -257,16 +257,16 @@ func (_c *EntityCreate) SetNillableWarrantyDetails(v *string) *EntityCreate {
return _c
}
-// SetPurchaseTime sets the "purchase_time" field.
-func (_c *EntityCreate) SetPurchaseTime(v time.Time) *EntityCreate {
- _c.mutation.SetPurchaseTime(v)
+// SetPurchaseDate sets the "purchase_date" field.
+func (_c *EntityCreate) SetPurchaseDate(v time.Time) *EntityCreate {
+ _c.mutation.SetPurchaseDate(v)
return _c
}
-// SetNillablePurchaseTime sets the "purchase_time" field if the given value is not nil.
-func (_c *EntityCreate) SetNillablePurchaseTime(v *time.Time) *EntityCreate {
+// SetNillablePurchaseDate sets the "purchase_date" field if the given value is not nil.
+func (_c *EntityCreate) SetNillablePurchaseDate(v *time.Time) *EntityCreate {
if v != nil {
- _c.SetPurchaseTime(*v)
+ _c.SetPurchaseDate(*v)
}
return _c
}
@@ -299,16 +299,16 @@ func (_c *EntityCreate) SetNillablePurchasePrice(v *float64) *EntityCreate {
return _c
}
-// SetSoldTime sets the "sold_time" field.
-func (_c *EntityCreate) SetSoldTime(v time.Time) *EntityCreate {
- _c.mutation.SetSoldTime(v)
+// SetSoldDate sets the "sold_date" field.
+func (_c *EntityCreate) SetSoldDate(v time.Time) *EntityCreate {
+ _c.mutation.SetSoldDate(v)
return _c
}
-// SetNillableSoldTime sets the "sold_time" field if the given value is not nil.
-func (_c *EntityCreate) SetNillableSoldTime(v *time.Time) *EntityCreate {
+// SetNillableSoldDate sets the "sold_date" field if the given value is not nil.
+func (_c *EntityCreate) SetNillableSoldDate(v *time.Time) *EntityCreate {
if v != nil {
- _c.SetSoldTime(*v)
+ _c.SetSoldDate(*v)
}
return _c
}
@@ -755,9 +755,9 @@ func (_c *EntityCreate) createSpec() (*Entity, *sqlgraph.CreateSpec) {
_spec.SetField(entity.FieldWarrantyDetails, field.TypeString, value)
_node.WarrantyDetails = value
}
- if value, ok := _c.mutation.PurchaseTime(); ok {
- _spec.SetField(entity.FieldPurchaseTime, field.TypeTime, value)
- _node.PurchaseTime = value
+ if value, ok := _c.mutation.PurchaseDate(); ok {
+ _spec.SetField(entity.FieldPurchaseDate, field.TypeTime, value)
+ _node.PurchaseDate = value
}
if value, ok := _c.mutation.PurchaseFrom(); ok {
_spec.SetField(entity.FieldPurchaseFrom, field.TypeString, value)
@@ -767,9 +767,9 @@ func (_c *EntityCreate) createSpec() (*Entity, *sqlgraph.CreateSpec) {
_spec.SetField(entity.FieldPurchasePrice, field.TypeFloat64, value)
_node.PurchasePrice = value
}
- if value, ok := _c.mutation.SoldTime(); ok {
- _spec.SetField(entity.FieldSoldTime, field.TypeTime, value)
- _node.SoldTime = value
+ if value, ok := _c.mutation.SoldDate(); ok {
+ _spec.SetField(entity.FieldSoldDate, field.TypeTime, value)
+ _node.SoldDate = value
}
if value, ok := _c.mutation.SoldTo(); ok {
_spec.SetField(entity.FieldSoldTo, field.TypeString, value)
diff --git a/backend/internal/data/ent/entity_update.go b/backend/internal/data/ent/entity_update.go
index 7a404a84..f3dbf1f4 100644
--- a/backend/internal/data/ent/entity_update.go
+++ b/backend/internal/data/ent/entity_update.go
@@ -313,23 +313,23 @@ func (_u *EntityUpdate) ClearWarrantyDetails() *EntityUpdate {
return _u
}
-// SetPurchaseTime sets the "purchase_time" field.
-func (_u *EntityUpdate) SetPurchaseTime(v time.Time) *EntityUpdate {
- _u.mutation.SetPurchaseTime(v)
+// SetPurchaseDate sets the "purchase_date" field.
+func (_u *EntityUpdate) SetPurchaseDate(v time.Time) *EntityUpdate {
+ _u.mutation.SetPurchaseDate(v)
return _u
}
-// SetNillablePurchaseTime sets the "purchase_time" field if the given value is not nil.
-func (_u *EntityUpdate) SetNillablePurchaseTime(v *time.Time) *EntityUpdate {
+// SetNillablePurchaseDate sets the "purchase_date" field if the given value is not nil.
+func (_u *EntityUpdate) SetNillablePurchaseDate(v *time.Time) *EntityUpdate {
if v != nil {
- _u.SetPurchaseTime(*v)
+ _u.SetPurchaseDate(*v)
}
return _u
}
-// ClearPurchaseTime clears the value of the "purchase_time" field.
-func (_u *EntityUpdate) ClearPurchaseTime() *EntityUpdate {
- _u.mutation.ClearPurchaseTime()
+// ClearPurchaseDate clears the value of the "purchase_date" field.
+func (_u *EntityUpdate) ClearPurchaseDate() *EntityUpdate {
+ _u.mutation.ClearPurchaseDate()
return _u
}
@@ -374,23 +374,23 @@ func (_u *EntityUpdate) AddPurchasePrice(v float64) *EntityUpdate {
return _u
}
-// SetSoldTime sets the "sold_time" field.
-func (_u *EntityUpdate) SetSoldTime(v time.Time) *EntityUpdate {
- _u.mutation.SetSoldTime(v)
+// SetSoldDate sets the "sold_date" field.
+func (_u *EntityUpdate) SetSoldDate(v time.Time) *EntityUpdate {
+ _u.mutation.SetSoldDate(v)
return _u
}
-// SetNillableSoldTime sets the "sold_time" field if the given value is not nil.
-func (_u *EntityUpdate) SetNillableSoldTime(v *time.Time) *EntityUpdate {
+// SetNillableSoldDate sets the "sold_date" field if the given value is not nil.
+func (_u *EntityUpdate) SetNillableSoldDate(v *time.Time) *EntityUpdate {
if v != nil {
- _u.SetSoldTime(*v)
+ _u.SetSoldDate(*v)
}
return _u
}
-// ClearSoldTime clears the value of the "sold_time" field.
-func (_u *EntityUpdate) ClearSoldTime() *EntityUpdate {
- _u.mutation.ClearSoldTime()
+// ClearSoldDate clears the value of the "sold_date" field.
+func (_u *EntityUpdate) ClearSoldDate() *EntityUpdate {
+ _u.mutation.ClearSoldDate()
return _u
}
@@ -881,11 +881,11 @@ func (_u *EntityUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if _u.mutation.WarrantyDetailsCleared() {
_spec.ClearField(entity.FieldWarrantyDetails, field.TypeString)
}
- if value, ok := _u.mutation.PurchaseTime(); ok {
- _spec.SetField(entity.FieldPurchaseTime, field.TypeTime, value)
+ if value, ok := _u.mutation.PurchaseDate(); ok {
+ _spec.SetField(entity.FieldPurchaseDate, field.TypeTime, value)
}
- if _u.mutation.PurchaseTimeCleared() {
- _spec.ClearField(entity.FieldPurchaseTime, field.TypeTime)
+ if _u.mutation.PurchaseDateCleared() {
+ _spec.ClearField(entity.FieldPurchaseDate, field.TypeTime)
}
if value, ok := _u.mutation.PurchaseFrom(); ok {
_spec.SetField(entity.FieldPurchaseFrom, field.TypeString, value)
@@ -899,11 +899,11 @@ func (_u *EntityUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if value, ok := _u.mutation.AddedPurchasePrice(); ok {
_spec.AddField(entity.FieldPurchasePrice, field.TypeFloat64, value)
}
- if value, ok := _u.mutation.SoldTime(); ok {
- _spec.SetField(entity.FieldSoldTime, field.TypeTime, value)
+ if value, ok := _u.mutation.SoldDate(); ok {
+ _spec.SetField(entity.FieldSoldDate, field.TypeTime, value)
}
- if _u.mutation.SoldTimeCleared() {
- _spec.ClearField(entity.FieldSoldTime, field.TypeTime)
+ if _u.mutation.SoldDateCleared() {
+ _spec.ClearField(entity.FieldSoldDate, field.TypeTime)
}
if value, ok := _u.mutation.SoldTo(); ok {
_spec.SetField(entity.FieldSoldTo, field.TypeString, value)
@@ -1533,23 +1533,23 @@ func (_u *EntityUpdateOne) ClearWarrantyDetails() *EntityUpdateOne {
return _u
}
-// SetPurchaseTime sets the "purchase_time" field.
-func (_u *EntityUpdateOne) SetPurchaseTime(v time.Time) *EntityUpdateOne {
- _u.mutation.SetPurchaseTime(v)
+// SetPurchaseDate sets the "purchase_date" field.
+func (_u *EntityUpdateOne) SetPurchaseDate(v time.Time) *EntityUpdateOne {
+ _u.mutation.SetPurchaseDate(v)
return _u
}
-// SetNillablePurchaseTime sets the "purchase_time" field if the given value is not nil.
-func (_u *EntityUpdateOne) SetNillablePurchaseTime(v *time.Time) *EntityUpdateOne {
+// SetNillablePurchaseDate sets the "purchase_date" field if the given value is not nil.
+func (_u *EntityUpdateOne) SetNillablePurchaseDate(v *time.Time) *EntityUpdateOne {
if v != nil {
- _u.SetPurchaseTime(*v)
+ _u.SetPurchaseDate(*v)
}
return _u
}
-// ClearPurchaseTime clears the value of the "purchase_time" field.
-func (_u *EntityUpdateOne) ClearPurchaseTime() *EntityUpdateOne {
- _u.mutation.ClearPurchaseTime()
+// ClearPurchaseDate clears the value of the "purchase_date" field.
+func (_u *EntityUpdateOne) ClearPurchaseDate() *EntityUpdateOne {
+ _u.mutation.ClearPurchaseDate()
return _u
}
@@ -1594,23 +1594,23 @@ func (_u *EntityUpdateOne) AddPurchasePrice(v float64) *EntityUpdateOne {
return _u
}
-// SetSoldTime sets the "sold_time" field.
-func (_u *EntityUpdateOne) SetSoldTime(v time.Time) *EntityUpdateOne {
- _u.mutation.SetSoldTime(v)
+// SetSoldDate sets the "sold_date" field.
+func (_u *EntityUpdateOne) SetSoldDate(v time.Time) *EntityUpdateOne {
+ _u.mutation.SetSoldDate(v)
return _u
}
-// SetNillableSoldTime sets the "sold_time" field if the given value is not nil.
-func (_u *EntityUpdateOne) SetNillableSoldTime(v *time.Time) *EntityUpdateOne {
+// SetNillableSoldDate sets the "sold_date" field if the given value is not nil.
+func (_u *EntityUpdateOne) SetNillableSoldDate(v *time.Time) *EntityUpdateOne {
if v != nil {
- _u.SetSoldTime(*v)
+ _u.SetSoldDate(*v)
}
return _u
}
-// ClearSoldTime clears the value of the "sold_time" field.
-func (_u *EntityUpdateOne) ClearSoldTime() *EntityUpdateOne {
- _u.mutation.ClearSoldTime()
+// ClearSoldDate clears the value of the "sold_date" field.
+func (_u *EntityUpdateOne) ClearSoldDate() *EntityUpdateOne {
+ _u.mutation.ClearSoldDate()
return _u
}
@@ -2131,11 +2131,11 @@ func (_u *EntityUpdateOne) sqlSave(ctx context.Context) (_node *Entity, err erro
if _u.mutation.WarrantyDetailsCleared() {
_spec.ClearField(entity.FieldWarrantyDetails, field.TypeString)
}
- if value, ok := _u.mutation.PurchaseTime(); ok {
- _spec.SetField(entity.FieldPurchaseTime, field.TypeTime, value)
+ if value, ok := _u.mutation.PurchaseDate(); ok {
+ _spec.SetField(entity.FieldPurchaseDate, field.TypeTime, value)
}
- if _u.mutation.PurchaseTimeCleared() {
- _spec.ClearField(entity.FieldPurchaseTime, field.TypeTime)
+ if _u.mutation.PurchaseDateCleared() {
+ _spec.ClearField(entity.FieldPurchaseDate, field.TypeTime)
}
if value, ok := _u.mutation.PurchaseFrom(); ok {
_spec.SetField(entity.FieldPurchaseFrom, field.TypeString, value)
@@ -2149,11 +2149,11 @@ func (_u *EntityUpdateOne) sqlSave(ctx context.Context) (_node *Entity, err erro
if value, ok := _u.mutation.AddedPurchasePrice(); ok {
_spec.AddField(entity.FieldPurchasePrice, field.TypeFloat64, value)
}
- if value, ok := _u.mutation.SoldTime(); ok {
- _spec.SetField(entity.FieldSoldTime, field.TypeTime, value)
+ if value, ok := _u.mutation.SoldDate(); ok {
+ _spec.SetField(entity.FieldSoldDate, field.TypeTime, value)
}
- if _u.mutation.SoldTimeCleared() {
- _spec.ClearField(entity.FieldSoldTime, field.TypeTime)
+ if _u.mutation.SoldDateCleared() {
+ _spec.ClearField(entity.FieldSoldDate, field.TypeTime)
}
if value, ok := _u.mutation.SoldTo(); ok {
_spec.SetField(entity.FieldSoldTo, field.TypeString, value)
diff --git a/backend/internal/data/ent/migrate/schema.go b/backend/internal/data/ent/migrate/schema.go
index b0288dc3..b5823b37 100644
--- a/backend/internal/data/ent/migrate/schema.go
+++ b/backend/internal/data/ent/migrate/schema.go
@@ -111,10 +111,10 @@ var (
{Name: "lifetime_warranty", Type: field.TypeBool, Default: false},
{Name: "warranty_expires", Type: field.TypeTime, Nullable: true},
{Name: "warranty_details", Type: field.TypeString, Nullable: true, Size: 1000},
- {Name: "purchase_time", Type: field.TypeTime, Nullable: true},
+ {Name: "purchase_date", Type: field.TypeTime, Nullable: true},
{Name: "purchase_from", Type: field.TypeString, Nullable: true},
{Name: "purchase_price", Type: field.TypeFloat64, Default: 0},
- {Name: "sold_time", Type: field.TypeTime, Nullable: true},
+ {Name: "sold_date", Type: field.TypeTime, Nullable: true},
{Name: "sold_to", Type: field.TypeString, Nullable: true},
{Name: "sold_price", Type: field.TypeFloat64, Default: 0},
{Name: "sold_notes", Type: field.TypeString, Nullable: true, Size: 1000},
diff --git a/backend/internal/data/ent/mutation.go b/backend/internal/data/ent/mutation.go
index 3ec8dd00..ab24e953 100644
--- a/backend/internal/data/ent/mutation.go
+++ b/backend/internal/data/ent/mutation.go
@@ -1874,11 +1874,11 @@ type EntityMutation struct {
lifetime_warranty *bool
warranty_expires *time.Time
warranty_details *string
- purchase_time *time.Time
+ purchase_date *time.Time
purchase_from *string
purchase_price *float64
addpurchase_price *float64
- sold_time *time.Time
+ sold_date *time.Time
sold_to *string
sold_price *float64
addsold_price *float64
@@ -2770,53 +2770,53 @@ func (m *EntityMutation) ResetWarrantyDetails() {
delete(m.clearedFields, entity.FieldWarrantyDetails)
}
-// SetPurchaseTime sets the "purchase_time" field.
-func (m *EntityMutation) SetPurchaseTime(t time.Time) {
- m.purchase_time = &t
+// SetPurchaseDate sets the "purchase_date" field.
+func (m *EntityMutation) SetPurchaseDate(t time.Time) {
+ m.purchase_date = &t
}
-// PurchaseTime returns the value of the "purchase_time" field in the mutation.
-func (m *EntityMutation) PurchaseTime() (r time.Time, exists bool) {
- v := m.purchase_time
+// PurchaseDate returns the value of the "purchase_date" field in the mutation.
+func (m *EntityMutation) PurchaseDate() (r time.Time, exists bool) {
+ v := m.purchase_date
if v == nil {
return
}
return *v, true
}
-// OldPurchaseTime returns the old "purchase_time" field's value of the Entity entity.
+// OldPurchaseDate returns the old "purchase_date" field's value of the Entity entity.
// If the Entity object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
-func (m *EntityMutation) OldPurchaseTime(ctx context.Context) (v time.Time, err error) {
+func (m *EntityMutation) OldPurchaseDate(ctx context.Context) (v time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
- return v, errors.New("OldPurchaseTime is only allowed on UpdateOne operations")
+ return v, errors.New("OldPurchaseDate is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
- return v, errors.New("OldPurchaseTime requires an ID field in the mutation")
+ return v, errors.New("OldPurchaseDate requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
- return v, fmt.Errorf("querying old value for OldPurchaseTime: %w", err)
+ return v, fmt.Errorf("querying old value for OldPurchaseDate: %w", err)
}
- return oldValue.PurchaseTime, nil
+ return oldValue.PurchaseDate, nil
}
-// ClearPurchaseTime clears the value of the "purchase_time" field.
-func (m *EntityMutation) ClearPurchaseTime() {
- m.purchase_time = nil
- m.clearedFields[entity.FieldPurchaseTime] = struct{}{}
+// ClearPurchaseDate clears the value of the "purchase_date" field.
+func (m *EntityMutation) ClearPurchaseDate() {
+ m.purchase_date = nil
+ m.clearedFields[entity.FieldPurchaseDate] = struct{}{}
}
-// PurchaseTimeCleared returns if the "purchase_time" field was cleared in this mutation.
-func (m *EntityMutation) PurchaseTimeCleared() bool {
- _, ok := m.clearedFields[entity.FieldPurchaseTime]
+// PurchaseDateCleared returns if the "purchase_date" field was cleared in this mutation.
+func (m *EntityMutation) PurchaseDateCleared() bool {
+ _, ok := m.clearedFields[entity.FieldPurchaseDate]
return ok
}
-// ResetPurchaseTime resets all changes to the "purchase_time" field.
-func (m *EntityMutation) ResetPurchaseTime() {
- m.purchase_time = nil
- delete(m.clearedFields, entity.FieldPurchaseTime)
+// ResetPurchaseDate resets all changes to the "purchase_date" field.
+func (m *EntityMutation) ResetPurchaseDate() {
+ m.purchase_date = nil
+ delete(m.clearedFields, entity.FieldPurchaseDate)
}
// SetPurchaseFrom sets the "purchase_from" field.
@@ -2924,53 +2924,53 @@ func (m *EntityMutation) ResetPurchasePrice() {
m.addpurchase_price = nil
}
-// SetSoldTime sets the "sold_time" field.
-func (m *EntityMutation) SetSoldTime(t time.Time) {
- m.sold_time = &t
+// SetSoldDate sets the "sold_date" field.
+func (m *EntityMutation) SetSoldDate(t time.Time) {
+ m.sold_date = &t
}
-// SoldTime returns the value of the "sold_time" field in the mutation.
-func (m *EntityMutation) SoldTime() (r time.Time, exists bool) {
- v := m.sold_time
+// SoldDate returns the value of the "sold_date" field in the mutation.
+func (m *EntityMutation) SoldDate() (r time.Time, exists bool) {
+ v := m.sold_date
if v == nil {
return
}
return *v, true
}
-// OldSoldTime returns the old "sold_time" field's value of the Entity entity.
+// OldSoldDate returns the old "sold_date" field's value of the Entity entity.
// If the Entity object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
-func (m *EntityMutation) OldSoldTime(ctx context.Context) (v time.Time, err error) {
+func (m *EntityMutation) OldSoldDate(ctx context.Context) (v time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
- return v, errors.New("OldSoldTime is only allowed on UpdateOne operations")
+ return v, errors.New("OldSoldDate is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
- return v, errors.New("OldSoldTime requires an ID field in the mutation")
+ return v, errors.New("OldSoldDate requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
- return v, fmt.Errorf("querying old value for OldSoldTime: %w", err)
+ return v, fmt.Errorf("querying old value for OldSoldDate: %w", err)
}
- return oldValue.SoldTime, nil
+ return oldValue.SoldDate, nil
}
-// ClearSoldTime clears the value of the "sold_time" field.
-func (m *EntityMutation) ClearSoldTime() {
- m.sold_time = nil
- m.clearedFields[entity.FieldSoldTime] = struct{}{}
+// ClearSoldDate clears the value of the "sold_date" field.
+func (m *EntityMutation) ClearSoldDate() {
+ m.sold_date = nil
+ m.clearedFields[entity.FieldSoldDate] = struct{}{}
}
-// SoldTimeCleared returns if the "sold_time" field was cleared in this mutation.
-func (m *EntityMutation) SoldTimeCleared() bool {
- _, ok := m.clearedFields[entity.FieldSoldTime]
+// SoldDateCleared returns if the "sold_date" field was cleared in this mutation.
+func (m *EntityMutation) SoldDateCleared() bool {
+ _, ok := m.clearedFields[entity.FieldSoldDate]
return ok
}
-// ResetSoldTime resets all changes to the "sold_time" field.
-func (m *EntityMutation) ResetSoldTime() {
- m.sold_time = nil
- delete(m.clearedFields, entity.FieldSoldTime)
+// ResetSoldDate resets all changes to the "sold_date" field.
+func (m *EntityMutation) ResetSoldDate() {
+ m.sold_date = nil
+ delete(m.clearedFields, entity.FieldSoldDate)
}
// SetSoldTo sets the "sold_to" field.
@@ -3600,8 +3600,8 @@ func (m *EntityMutation) Fields() []string {
if m.warranty_details != nil {
fields = append(fields, entity.FieldWarrantyDetails)
}
- if m.purchase_time != nil {
- fields = append(fields, entity.FieldPurchaseTime)
+ if m.purchase_date != nil {
+ fields = append(fields, entity.FieldPurchaseDate)
}
if m.purchase_from != nil {
fields = append(fields, entity.FieldPurchaseFrom)
@@ -3609,8 +3609,8 @@ func (m *EntityMutation) Fields() []string {
if m.purchase_price != nil {
fields = append(fields, entity.FieldPurchasePrice)
}
- if m.sold_time != nil {
- fields = append(fields, entity.FieldSoldTime)
+ if m.sold_date != nil {
+ fields = append(fields, entity.FieldSoldDate)
}
if m.sold_to != nil {
fields = append(fields, entity.FieldSoldTo)
@@ -3663,14 +3663,14 @@ func (m *EntityMutation) Field(name string) (ent.Value, bool) {
return m.WarrantyExpires()
case entity.FieldWarrantyDetails:
return m.WarrantyDetails()
- case entity.FieldPurchaseTime:
- return m.PurchaseTime()
+ case entity.FieldPurchaseDate:
+ return m.PurchaseDate()
case entity.FieldPurchaseFrom:
return m.PurchaseFrom()
case entity.FieldPurchasePrice:
return m.PurchasePrice()
- case entity.FieldSoldTime:
- return m.SoldTime()
+ case entity.FieldSoldDate:
+ return m.SoldDate()
case entity.FieldSoldTo:
return m.SoldTo()
case entity.FieldSoldPrice:
@@ -3720,14 +3720,14 @@ func (m *EntityMutation) OldField(ctx context.Context, name string) (ent.Value,
return m.OldWarrantyExpires(ctx)
case entity.FieldWarrantyDetails:
return m.OldWarrantyDetails(ctx)
- case entity.FieldPurchaseTime:
- return m.OldPurchaseTime(ctx)
+ case entity.FieldPurchaseDate:
+ return m.OldPurchaseDate(ctx)
case entity.FieldPurchaseFrom:
return m.OldPurchaseFrom(ctx)
case entity.FieldPurchasePrice:
return m.OldPurchasePrice(ctx)
- case entity.FieldSoldTime:
- return m.OldSoldTime(ctx)
+ case entity.FieldSoldDate:
+ return m.OldSoldDate(ctx)
case entity.FieldSoldTo:
return m.OldSoldTo(ctx)
case entity.FieldSoldPrice:
@@ -3862,12 +3862,12 @@ func (m *EntityMutation) SetField(name string, value ent.Value) error {
}
m.SetWarrantyDetails(v)
return nil
- case entity.FieldPurchaseTime:
+ case entity.FieldPurchaseDate:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
- m.SetPurchaseTime(v)
+ m.SetPurchaseDate(v)
return nil
case entity.FieldPurchaseFrom:
v, ok := value.(string)
@@ -3883,12 +3883,12 @@ func (m *EntityMutation) SetField(name string, value ent.Value) error {
}
m.SetPurchasePrice(v)
return nil
- case entity.FieldSoldTime:
+ case entity.FieldSoldDate:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
- m.SetSoldTime(v)
+ m.SetSoldDate(v)
return nil
case entity.FieldSoldTo:
v, ok := value.(string)
@@ -4016,14 +4016,14 @@ func (m *EntityMutation) ClearedFields() []string {
if m.FieldCleared(entity.FieldWarrantyDetails) {
fields = append(fields, entity.FieldWarrantyDetails)
}
- if m.FieldCleared(entity.FieldPurchaseTime) {
- fields = append(fields, entity.FieldPurchaseTime)
+ if m.FieldCleared(entity.FieldPurchaseDate) {
+ fields = append(fields, entity.FieldPurchaseDate)
}
if m.FieldCleared(entity.FieldPurchaseFrom) {
fields = append(fields, entity.FieldPurchaseFrom)
}
- if m.FieldCleared(entity.FieldSoldTime) {
- fields = append(fields, entity.FieldSoldTime)
+ if m.FieldCleared(entity.FieldSoldDate) {
+ fields = append(fields, entity.FieldSoldDate)
}
if m.FieldCleared(entity.FieldSoldTo) {
fields = append(fields, entity.FieldSoldTo)
@@ -4069,14 +4069,14 @@ func (m *EntityMutation) ClearField(name string) error {
case entity.FieldWarrantyDetails:
m.ClearWarrantyDetails()
return nil
- case entity.FieldPurchaseTime:
- m.ClearPurchaseTime()
+ case entity.FieldPurchaseDate:
+ m.ClearPurchaseDate()
return nil
case entity.FieldPurchaseFrom:
m.ClearPurchaseFrom()
return nil
- case entity.FieldSoldTime:
- m.ClearSoldTime()
+ case entity.FieldSoldDate:
+ m.ClearSoldDate()
return nil
case entity.FieldSoldTo:
m.ClearSoldTo()
@@ -4143,8 +4143,8 @@ func (m *EntityMutation) ResetField(name string) error {
case entity.FieldWarrantyDetails:
m.ResetWarrantyDetails()
return nil
- case entity.FieldPurchaseTime:
- m.ResetPurchaseTime()
+ case entity.FieldPurchaseDate:
+ m.ResetPurchaseDate()
return nil
case entity.FieldPurchaseFrom:
m.ResetPurchaseFrom()
@@ -4152,8 +4152,8 @@ func (m *EntityMutation) ResetField(name string) error {
case entity.FieldPurchasePrice:
m.ResetPurchasePrice()
return nil
- case entity.FieldSoldTime:
- m.ResetSoldTime()
+ case entity.FieldSoldDate:
+ m.ResetSoldDate()
return nil
case entity.FieldSoldTo:
m.ResetSoldTo()
diff --git a/backend/internal/data/ent/schema/entity.go b/backend/internal/data/ent/schema/entity.go
index fa441ed1..c5cf5c87 100644
--- a/backend/internal/data/ent/schema/entity.go
+++ b/backend/internal/data/ent/schema/entity.go
@@ -77,7 +77,7 @@ func (Entity) Fields() []ent.Field {
// ------------------------------------
// item purchase
- field.Time("purchase_time").
+ field.Time("purchase_date").
Optional(),
field.String("purchase_from").
Optional(),
@@ -86,7 +86,7 @@ func (Entity) Fields() []ent.Field {
// ------------------------------------
// Sold Details
- field.Time("sold_time").
+ field.Time("sold_date").
Optional(),
field.String("sold_to").
Optional(),
diff --git a/backend/internal/data/migrations/postgres/20260425000000_rename_date_columns.sql b/backend/internal/data/migrations/postgres/20260425000000_rename_date_columns.sql
new file mode 100644
index 00000000..bbefc272
--- /dev/null
+++ b/backend/internal/data/migrations/postgres/20260425000000_rename_date_columns.sql
@@ -0,0 +1,19 @@
+-- +goose Up
+-- Rename purchase_time/sold_time → purchase_date/sold_date to make the
+-- intended semantics explicit: at the application layer these are calendar
+-- dates with no time-of-day or timezone. The misleading "_time" name caused
+-- JSON round-trips to drift the day across timezones (issue #437).
+--
+-- This is a cosmetic rename only. ALTER TABLE ... RENAME COLUMN preserves
+-- the underlying timestamptz type — purchase_date and sold_date remain
+-- timestamptz after this migration runs. Date-only semantics are enforced
+-- by the Go layer (internal/data/types.Date), which truncates to YYYY-MM-DD
+-- on JSON marshal and via DateFromTime on every write through the repo.
+-- Any value written outside that path may still carry a non-midnight time.
+
+ALTER TABLE entities RENAME COLUMN purchase_time TO purchase_date;
+ALTER TABLE entities RENAME COLUMN sold_time TO sold_date;
+
+-- +goose Down
+ALTER TABLE entities RENAME COLUMN purchase_date TO purchase_time;
+ALTER TABLE entities RENAME COLUMN sold_date TO sold_time;
diff --git a/backend/internal/data/migrations/sqlite3/20260425000000_rename_date_columns.sql b/backend/internal/data/migrations/sqlite3/20260425000000_rename_date_columns.sql
new file mode 100644
index 00000000..1265fe39
--- /dev/null
+++ b/backend/internal/data/migrations/sqlite3/20260425000000_rename_date_columns.sql
@@ -0,0 +1,19 @@
+-- +goose Up
+-- Rename purchase_time/sold_time → purchase_date/sold_date to make the
+-- intended semantics explicit: at the application layer these are calendar
+-- dates with no time-of-day or timezone. The misleading "_time" name caused
+-- JSON round-trips to drift the day across timezones (issue #437).
+--
+-- This is a cosmetic rename only. ALTER TABLE ... RENAME COLUMN preserves
+-- the underlying datetime type — purchase_date and sold_date remain
+-- datetime after this migration runs. Date-only semantics are enforced by
+-- the Go layer (internal/data/types.Date), which truncates to YYYY-MM-DD
+-- on JSON marshal and via DateFromTime on every write through the repo.
+-- Any value written outside that path may still carry a non-midnight time.
+
+ALTER TABLE entities RENAME COLUMN purchase_time TO purchase_date;
+ALTER TABLE entities RENAME COLUMN sold_time TO sold_date;
+
+-- +goose Down
+ALTER TABLE entities RENAME COLUMN purchase_date TO purchase_time;
+ALTER TABLE entities RENAME COLUMN sold_date TO sold_time;
diff --git a/backend/internal/data/repo/repo_entities.go b/backend/internal/data/repo/repo_entities.go
index 78162ad6..4e185172 100644
--- a/backend/internal/data/repo/repo_entities.go
+++ b/backend/internal/data/repo/repo_entities.go
@@ -126,12 +126,12 @@ type (
WarrantyDetails string `json:"warrantyDetails"`
// Purchase
- PurchaseTime types.Date `json:"purchaseTime"`
+ PurchaseDate types.Date `json:"purchaseDate"`
PurchaseFrom string `json:"purchaseFrom" validate:"max=255"`
PurchasePrice float64 `json:"purchasePrice" extensions:"x-nullable,x-omitempty"`
// Sold
- SoldTime types.Date `json:"soldTime"`
+ SoldDate types.Date `json:"soldDate"`
SoldTo string `json:"soldTo" validate:"max=255"`
SoldPrice float64 `json:"soldPrice" extensions:"x-nullable,x-omitempty"`
SoldNotes string `json:"soldNotes"`
@@ -173,7 +173,7 @@ type (
ThumbnailId *uuid.UUID `json:"thumbnailId,omitempty" extensions:"x-nullable,x-omitempty"`
// Sale details
- SoldTime time.Time `json:"soldTime"`
+ SoldDate types.Date `json:"soldDate"`
// Container-specific (populated when querying locations)
ItemCount float64 `json:"itemCount,omitempty"`
@@ -196,11 +196,11 @@ type (
WarrantyDetails string `json:"warrantyDetails"`
// Purchase
- PurchaseTime types.Date `json:"purchaseTime"`
+ PurchaseDate types.Date `json:"purchaseDate"`
PurchaseFrom string `json:"purchaseFrom"`
// Sold
- SoldTime types.Date `json:"soldTime"`
+ SoldDate types.Date `json:"soldDate"`
SoldTo string `json:"soldTo"`
SoldPrice float64 `json:"soldPrice"`
SoldNotes string `json:"soldNotes"`
@@ -274,6 +274,9 @@ func mapEntitySummary(e *ent.Entity) EntitySummary {
Insured: e.Insured,
ImageID: imageID,
ThumbnailId: thumbnailID,
+
+ // Sale
+ SoldDate: types.DateFromTime(e.SoldDate),
}
}
@@ -338,11 +341,11 @@ func mapEntityOut(e *ent.Entity) EntityOut {
Manufacturer: e.Manufacturer,
// Purchase
- PurchaseTime: types.DateFromTime(e.PurchaseTime),
+ PurchaseDate: types.DateFromTime(e.PurchaseDate),
PurchaseFrom: e.PurchaseFrom,
// Sold
- SoldTime: types.DateFromTime(e.SoldTime),
+ SoldDate: types.DateFromTime(e.SoldDate),
SoldTo: e.SoldTo,
SoldPrice: e.SoldPrice,
SoldNotes: e.SoldNotes,
@@ -1424,22 +1427,38 @@ func (r *EntityRepository) UpdateByGroup(ctx context.Context, gid uuid.UUID, dat
SetModelNumber(data.ModelNumber).
SetManufacturer(data.Manufacturer).
SetArchived(data.Archived).
- SetPurchaseTime(data.PurchaseTime.Time()).
SetPurchaseFrom(data.PurchaseFrom).
SetPurchasePrice(data.PurchasePrice).
- SetSoldTime(data.SoldTime.Time()).
SetSoldTo(data.SoldTo).
SetSoldPrice(data.SoldPrice).
SetSoldNotes(data.SoldNotes).
SetNotes(data.Notes).
SetLifetimeWarranty(data.LifetimeWarranty).
SetInsured(data.Insured).
- SetWarrantyExpires(data.WarrantyExpires.Time()).
SetWarrantyDetails(data.WarrantyDetails).
SetQuantity(data.Quantity).
SetAssetID(int64(data.AssetID)).
SetSyncChildEntityLocations(data.SyncChildEntityLocations)
+ // Date fields are nullable. Writing types.Date{}.Time() would persist
+ // the 0001-01-01 sentinel that ZeroOutTimeFields then has to chase —
+ // clear the column instead so absent dates round-trip as NULL/"".
+ if t := data.PurchaseDate.Time(); t.IsZero() {
+ q.ClearPurchaseDate()
+ } else {
+ q.SetPurchaseDate(t)
+ }
+ if t := data.SoldDate.Time(); t.IsZero() {
+ q.ClearSoldDate()
+ } else {
+ q.SetSoldDate(t)
+ }
+ if t := data.WarrantyExpires.Time(); t.IsZero() {
+ q.ClearWarrantyExpires()
+ } else {
+ q.SetWarrantyExpires(t)
+ }
+
if data.EntityTypeID != uuid.Nil {
q.SetEntityTypeID(data.EntityTypeID)
}
@@ -1883,9 +1902,9 @@ func (r *EntityRepository) ZeroOutTimeFields(ctx context.Context, gid uuid.UUID)
q := r.db.Entity.Query().Where(
entity.HasGroupWith(group.ID(gid)),
entity.Or(
- entity.PurchaseTimeNotNil(),
+ entity.PurchaseDateNotNil(),
entity.PurchaseFromLT("0002-01-01"),
- entity.SoldTimeNotNil(),
+ entity.SoldDateNotNil(),
entity.SoldToLT("0002-01-01"),
entity.WarrantyExpiresNotNil(),
entity.WarrantyDetailsLT("0002-01-01"),
@@ -1919,26 +1938,26 @@ func (r *EntityRepository) ZeroOutTimeFields(ctx context.Context, gid uuid.UUID)
for _, e := range entities {
updateQ := r.db.Entity.Update().Where(entity.ID(e.ID))
- if !e.PurchaseTime.IsZero() {
+ if !e.PurchaseDate.IsZero() {
switch {
- case e.PurchaseTime.Year() < 100:
- updateQ.ClearPurchaseTime()
+ case e.PurchaseDate.Year() < 100:
+ updateQ.ClearPurchaseDate()
default:
- updateQ.SetPurchaseTime(toDateOnly(e.PurchaseTime))
+ updateQ.SetPurchaseDate(toDateOnly(e.PurchaseDate))
}
} else {
- updateQ.ClearPurchaseTime()
+ updateQ.ClearPurchaseDate()
}
- if !e.SoldTime.IsZero() {
+ if !e.SoldDate.IsZero() {
switch {
- case e.SoldTime.Year() < 100:
- updateQ.ClearSoldTime()
+ case e.SoldDate.Year() < 100:
+ updateQ.ClearSoldDate()
default:
- updateQ.SetSoldTime(toDateOnly(e.SoldTime))
+ updateQ.SetSoldDate(toDateOnly(e.SoldDate))
}
} else {
- updateQ.ClearSoldTime()
+ updateQ.ClearSoldDate()
}
if !e.WarrantyExpires.IsZero() {
@@ -2096,12 +2115,9 @@ func (r *EntityRepository) Duplicate(ctx context.Context, gid, id uuid.UUID, opt
SetModelNumber(originalEntity.ModelNumber).
SetManufacturer(originalEntity.Manufacturer).
SetLifetimeWarranty(originalEntity.LifetimeWarranty).
- SetWarrantyExpires(originalEntity.WarrantyExpires.Time()).
SetWarrantyDetails(originalEntity.WarrantyDetails).
- SetPurchaseTime(originalEntity.PurchaseTime.Time()).
SetPurchaseFrom(originalEntity.PurchaseFrom).
SetPurchasePrice(originalEntity.PurchasePrice).
- SetSoldTime(originalEntity.SoldTime.Time()).
SetSoldTo(originalEntity.SoldTo).
SetSoldPrice(originalEntity.SoldPrice).
SetSoldNotes(originalEntity.SoldNotes).
@@ -2110,6 +2126,18 @@ func (r *EntityRepository) Duplicate(ctx context.Context, gid, id uuid.UUID, opt
SetArchived(originalEntity.Archived).
SetSyncChildEntityLocations(originalEntity.SyncChildEntityLocations)
+ // Skip Set on zero dates so the duplicate's nullable date columns end up
+ // NULL rather than the 0001-01-01 sentinel.
+ if t := originalEntity.PurchaseDate.Time(); !t.IsZero() {
+ entityBuilder.SetPurchaseDate(t)
+ }
+ if t := originalEntity.SoldDate.Time(); !t.IsZero() {
+ entityBuilder.SetSoldDate(t)
+ }
+ if t := originalEntity.WarrantyExpires.Time(); !t.IsZero() {
+ entityBuilder.SetWarrantyExpires(t)
+ }
+
if originalEntity.Parent != nil {
entityBuilder.SetParentID(originalEntity.Parent.ID)
}
diff --git a/backend/internal/data/repo/repo_entities_test.go b/backend/internal/data/repo/repo_entities_test.go
index 7955d03d..5604acdc 100644
--- a/backend/internal/data/repo/repo_entities_test.go
+++ b/backend/internal/data/repo/repo_entities_test.go
@@ -347,10 +347,10 @@ func TestEntityRepository_Update(t *testing.T) {
TagIDs: nil,
ModelNumber: fk.Str(10),
Manufacturer: fk.Str(10),
- PurchaseTime: types.DateFromTime(time.Now()),
+ PurchaseDate: types.DateFromTime(time.Now()),
PurchaseFrom: fk.Str(10),
PurchasePrice: 300.99,
- SoldTime: types.DateFromTime(time.Now()),
+ SoldDate: types.DateFromTime(time.Now()),
SoldTo: fk.Str(10),
SoldPrice: 300.99,
SoldNotes: fk.Str(10),
diff --git a/docs/public/api/openapi-3.0.json b/docs/public/api/openapi-3.0.json
index 4184b023..bf4b6ed1 100644
--- a/docs/public/api/openapi-3.0.json
+++ b/docs/public/api/openapi-3.0.json
@@ -3268,6 +3268,10 @@
"description": "Notes holds the value of the \"notes\" field.",
"type": "string"
},
+ "purchase_date": {
+ "description": "PurchaseDate holds the value of the \"purchase_date\" field.",
+ "type": "string"
+ },
"purchase_from": {
"description": "PurchaseFrom holds the value of the \"purchase_from\" field.",
"type": "string"
@@ -3276,10 +3280,6 @@
"description": "PurchasePrice holds the value of the \"purchase_price\" field.",
"type": "number"
},
- "purchase_time": {
- "description": "PurchaseTime holds the value of the \"purchase_time\" field.",
- "type": "string"
- },
"quantity": {
"description": "Quantity holds the value of the \"quantity\" field.",
"type": "number"
@@ -3288,6 +3288,10 @@
"description": "SerialNumber holds the value of the \"serial_number\" field.",
"type": "string"
},
+ "sold_date": {
+ "description": "SoldDate holds the value of the \"sold_date\" field.",
+ "type": "string"
+ },
"sold_notes": {
"description": "SoldNotes holds the value of the \"sold_notes\" field.",
"type": "string"
@@ -3296,10 +3300,6 @@
"description": "SoldPrice holds the value of the \"sold_price\" field.",
"type": "number"
},
- "sold_time": {
- "description": "SoldTime holds the value of the \"sold_time\" field.",
- "type": "string"
- },
"sold_to": {
"description": "SoldTo holds the value of the \"sold_to\" field.",
"type": "string"
@@ -4376,32 +4376,32 @@
"x-omitempty": true,
"nullable": true
},
+ "purchaseDate": {
+ "description": "Purchase",
+ "type": "string"
+ },
"purchaseFrom": {
"type": "string"
},
"purchasePrice": {
"type": "number"
},
- "purchaseTime": {
- "description": "Purchase",
- "type": "string"
- },
"quantity": {
"type": "number"
},
"serialNumber": {
"type": "string"
},
+ "soldDate": {
+ "description": "Sold",
+ "type": "string"
+ },
"soldNotes": {
"type": "string"
},
"soldPrice": {
"type": "number"
},
- "soldTime": {
- "description": "Sold",
- "type": "string"
- },
"soldTo": {
"type": "string"
},
@@ -4548,7 +4548,7 @@
"quantity": {
"type": "number"
},
- "soldTime": {
+ "soldDate": {
"description": "Sale details",
"type": "string"
},
@@ -4966,6 +4966,10 @@
"x-omitempty": true,
"nullable": true
},
+ "purchaseDate": {
+ "description": "Purchase",
+ "type": "string"
+ },
"purchaseFrom": {
"type": "string",
"maxLength": 255
@@ -4975,10 +4979,6 @@
"x-omitempty": true,
"nullable": true
},
- "purchaseTime": {
- "description": "Purchase",
- "type": "string"
- },
"quantity": {
"type": "number"
},
@@ -4986,6 +4986,10 @@
"description": "Identifications",
"type": "string"
},
+ "soldDate": {
+ "description": "Sold",
+ "type": "string"
+ },
"soldNotes": {
"type": "string"
},
@@ -4994,10 +4998,6 @@
"x-omitempty": true,
"nullable": true
},
- "soldTime": {
- "description": "Sold",
- "type": "string"
- },
"soldTo": {
"type": "string",
"maxLength": 255
diff --git a/docs/public/api/openapi-3.0.yaml b/docs/public/api/openapi-3.0.yaml
index 300e66e8..5a1b846d 100644
--- a/docs/public/api/openapi-3.0.yaml
+++ b/docs/public/api/openapi-3.0.yaml
@@ -1962,30 +1962,30 @@ components:
notes:
description: Notes holds the value of the "notes" field.
type: string
+ purchase_date:
+ description: PurchaseDate holds the value of the "purchase_date" field.
+ type: string
purchase_from:
description: PurchaseFrom holds the value of the "purchase_from" field.
type: string
purchase_price:
description: PurchasePrice holds the value of the "purchase_price" field.
type: number
- purchase_time:
- description: PurchaseTime holds the value of the "purchase_time" field.
- type: string
quantity:
description: Quantity holds the value of the "quantity" field.
type: number
serial_number:
description: SerialNumber holds the value of the "serial_number" field.
type: string
+ sold_date:
+ description: SoldDate holds the value of the "sold_date" field.
+ type: string
sold_notes:
description: SoldNotes holds the value of the "sold_notes" field.
type: string
sold_price:
description: SoldPrice holds the value of the "sold_price" field.
type: number
- sold_time:
- description: SoldTime holds the value of the "sold_time" field.
- type: string
sold_to:
description: SoldTo holds the value of the "sold_to" field.
type: string
@@ -2737,24 +2737,24 @@ components:
- $ref: "#/components/schemas/repo.EntitySummary"
x-omitempty: true
nullable: true
+ purchaseDate:
+ description: Purchase
+ type: string
purchaseFrom:
type: string
purchasePrice:
type: number
- purchaseTime:
- description: Purchase
- type: string
quantity:
type: number
serialNumber:
type: string
+ soldDate:
+ description: Sold
+ type: string
soldNotes:
type: string
soldPrice:
type: number
- soldTime:
- description: Sold
- type: string
soldTo:
type: string
syncChildEntityLocations:
@@ -2855,7 +2855,7 @@ components:
type: number
quantity:
type: number
- soldTime:
+ soldDate:
description: Sale details
type: string
tags:
@@ -3148,6 +3148,9 @@ components:
type: string
x-omitempty: true
nullable: true
+ purchaseDate:
+ description: Purchase
+ type: string
purchaseFrom:
type: string
maxLength: 255
@@ -3155,23 +3158,20 @@ components:
type: number
x-omitempty: true
nullable: true
- purchaseTime:
- description: Purchase
- type: string
quantity:
type: number
serialNumber:
description: Identifications
type: string
+ soldDate:
+ description: Sold
+ type: string
soldNotes:
type: string
soldPrice:
type: number
x-omitempty: true
nullable: true
- soldTime:
- description: Sold
- type: string
soldTo:
type: string
maxLength: 255
diff --git a/docs/public/api/swagger-2.0.json b/docs/public/api/swagger-2.0.json
index 8053cb1b..f9c9bd75 100644
--- a/docs/public/api/swagger-2.0.json
+++ b/docs/public/api/swagger-2.0.json
@@ -3071,6 +3071,10 @@
"description": "Notes holds the value of the \"notes\" field.",
"type": "string"
},
+ "purchase_date": {
+ "description": "PurchaseDate holds the value of the \"purchase_date\" field.",
+ "type": "string"
+ },
"purchase_from": {
"description": "PurchaseFrom holds the value of the \"purchase_from\" field.",
"type": "string"
@@ -3079,10 +3083,6 @@
"description": "PurchasePrice holds the value of the \"purchase_price\" field.",
"type": "number"
},
- "purchase_time": {
- "description": "PurchaseTime holds the value of the \"purchase_time\" field.",
- "type": "string"
- },
"quantity": {
"description": "Quantity holds the value of the \"quantity\" field.",
"type": "number"
@@ -3091,6 +3091,10 @@
"description": "SerialNumber holds the value of the \"serial_number\" field.",
"type": "string"
},
+ "sold_date": {
+ "description": "SoldDate holds the value of the \"sold_date\" field.",
+ "type": "string"
+ },
"sold_notes": {
"description": "SoldNotes holds the value of the \"sold_notes\" field.",
"type": "string"
@@ -3099,10 +3103,6 @@
"description": "SoldPrice holds the value of the \"sold_price\" field.",
"type": "number"
},
- "sold_time": {
- "description": "SoldTime holds the value of the \"sold_time\" field.",
- "type": "string"
- },
"sold_to": {
"description": "SoldTo holds the value of the \"sold_to\" field.",
"type": "string"
@@ -4179,32 +4179,32 @@
"x-nullable": true,
"x-omitempty": true
},
+ "purchaseDate": {
+ "description": "Purchase",
+ "type": "string"
+ },
"purchaseFrom": {
"type": "string"
},
"purchasePrice": {
"type": "number"
},
- "purchaseTime": {
- "description": "Purchase",
- "type": "string"
- },
"quantity": {
"type": "number"
},
"serialNumber": {
"type": "string"
},
+ "soldDate": {
+ "description": "Sold",
+ "type": "string"
+ },
"soldNotes": {
"type": "string"
},
"soldPrice": {
"type": "number"
},
- "soldTime": {
- "description": "Sold",
- "type": "string"
- },
"soldTo": {
"type": "string"
},
@@ -4351,7 +4351,7 @@
"quantity": {
"type": "number"
},
- "soldTime": {
+ "soldDate": {
"description": "Sale details",
"type": "string"
},
@@ -4769,6 +4769,10 @@
"x-nullable": true,
"x-omitempty": true
},
+ "purchaseDate": {
+ "description": "Purchase",
+ "type": "string"
+ },
"purchaseFrom": {
"type": "string",
"maxLength": 255
@@ -4778,10 +4782,6 @@
"x-nullable": true,
"x-omitempty": true
},
- "purchaseTime": {
- "description": "Purchase",
- "type": "string"
- },
"quantity": {
"type": "number"
},
@@ -4789,6 +4789,10 @@
"description": "Identifications",
"type": "string"
},
+ "soldDate": {
+ "description": "Sold",
+ "type": "string"
+ },
"soldNotes": {
"type": "string"
},
@@ -4797,10 +4801,6 @@
"x-nullable": true,
"x-omitempty": true
},
- "soldTime": {
- "description": "Sold",
- "type": "string"
- },
"soldTo": {
"type": "string",
"maxLength": 255
diff --git a/docs/public/api/swagger-2.0.yaml b/docs/public/api/swagger-2.0.yaml
index 3dfec4d3..dfca1378 100644
--- a/docs/public/api/swagger-2.0.yaml
+++ b/docs/public/api/swagger-2.0.yaml
@@ -192,30 +192,30 @@ definitions:
notes:
description: Notes holds the value of the "notes" field.
type: string
+ purchase_date:
+ description: PurchaseDate holds the value of the "purchase_date" field.
+ type: string
purchase_from:
description: PurchaseFrom holds the value of the "purchase_from" field.
type: string
purchase_price:
description: PurchasePrice holds the value of the "purchase_price" field.
type: number
- purchase_time:
- description: PurchaseTime holds the value of the "purchase_time" field.
- type: string
quantity:
description: Quantity holds the value of the "quantity" field.
type: number
serial_number:
description: SerialNumber holds the value of the "serial_number" field.
type: string
+ sold_date:
+ description: SoldDate holds the value of the "sold_date" field.
+ type: string
sold_notes:
description: SoldNotes holds the value of the "sold_notes" field.
type: string
sold_price:
description: SoldPrice holds the value of the "sold_price" field.
type: number
- sold_time:
- description: SoldTime holds the value of the "sold_time" field.
- type: string
sold_to:
description: SoldTo holds the value of the "sold_to" field.
type: string
@@ -958,24 +958,24 @@ definitions:
description: Edges
x-nullable: true
x-omitempty: true
+ purchaseDate:
+ description: Purchase
+ type: string
purchaseFrom:
type: string
purchasePrice:
type: number
- purchaseTime:
- description: Purchase
- type: string
quantity:
type: number
serialNumber:
type: string
+ soldDate:
+ description: Sold
+ type: string
soldNotes:
type: string
soldPrice:
type: number
- soldTime:
- description: Sold
- type: string
soldTo:
type: string
syncChildEntityLocations:
@@ -1076,7 +1076,7 @@ definitions:
type: number
quantity:
type: number
- soldTime:
+ soldDate:
description: Sale details
type: string
tags:
@@ -1367,6 +1367,9 @@ definitions:
type: string
x-nullable: true
x-omitempty: true
+ purchaseDate:
+ description: Purchase
+ type: string
purchaseFrom:
maxLength: 255
type: string
@@ -1374,23 +1377,20 @@ definitions:
type: number
x-nullable: true
x-omitempty: true
- purchaseTime:
- description: Purchase
- type: string
quantity:
type: number
serialNumber:
description: Identifications
type: string
+ soldDate:
+ description: Sold
+ type: string
soldNotes:
type: string
soldPrice:
type: number
x-nullable: true
x-omitempty: true
- soldTime:
- description: Sold
- type: string
soldTo:
maxLength: 255
type: string
diff --git a/frontend/components/Form/DatePicker.vue b/frontend/components/Form/DatePicker.vue
index c4088ec9..8f2b22db 100644
--- a/frontend/components/Form/DatePicker.vue
+++ b/frontend/components/Form/DatePicker.vue
@@ -13,6 +13,7 @@
import VueDatePicker from "@vuepic/vue-datepicker";
import "@vuepic/vue-datepicker/dist/main.css";
import * as datelib from "~/lib/datelib/datelib";
+ import { toDateOnlyString } from "~/lib/datelib/dateOnly";
import { Label } from "@/components/ui/label";
import { darkThemes } from "~/lib/data/themes";
@@ -20,7 +21,7 @@
const props = defineProps({
modelValue: {
- type: Date as () => Date | string | null,
+ type: [Date, String] as unknown as () => Date | string | null,
required: false,
default: null,
},
@@ -32,6 +33,19 @@
type: String,
default: "Date",
},
+ // When true, this field represents a date-only value (no time-of-day or
+ // timezone semantics). modelValue is bound as a YYYY-MM-DD string and the
+ // component emits a YYYY-MM-DD string. Use this for any field stored as
+ // types.Date on the backend (purchaseDate, scheduledDate, etc.) — it
+ // prevents the timezone day-shift bug that occurs when JSON.stringify
+ // converts a Date object to a UTC ISO string.
+ //
+ // Leave false (the default) for true timestamp fields like invite expiry,
+ // which need full Date-object precision.
+ dateOnly: {
+ type: Boolean,
+ default: false,
+ },
});
const isDark = useIsThemeInList(darkThemes);
@@ -72,7 +86,13 @@
return null;
},
set(value: Date | null) {
- console.debug("DatePicker: SET", value);
+ if (props.dateOnly) {
+ // Always emit YYYY-MM-DD strings, derived from local components, so
+ // the user's calendar day is preserved across the API round-trip.
+ emit("update:modelValue", value ? toDateOnlyString(value) : "");
+ return;
+ }
+
if (value instanceof Date) {
value = datelib.zeroTime(value);
emit("update:modelValue", value);
diff --git a/frontend/components/Maintenance/EditModal.vue b/frontend/components/Maintenance/EditModal.vue
index 45157ed0..f839c7b8 100644
--- a/frontend/components/Maintenance/EditModal.vue
+++ b/frontend/components/Maintenance/EditModal.vue
@@ -9,8 +9,8 @@
<form class="flex flex-col gap-2" @submit.prevent="dispatchFormSubmit">
<FormTextField v-model="entry.name" autofocus :label="$t('maintenance.modal.entry_name')" />
- <DatePicker v-model="entry.completedDate" :label="$t('maintenance.modal.completed_date')" />
- <DatePicker v-model="entry.scheduledDate" :label="$t('maintenance.modal.scheduled_date')" />
+ <DatePicker v-model="entry.completedDate" date-only :label="$t('maintenance.modal.completed_date')" />
+ <DatePicker v-model="entry.scheduledDate" date-only :label="$t('maintenance.modal.scheduled_date')" />
<FormTextArea v-model="entry.description" :label="$t('maintenance.modal.notes')" />
<FormTextField v-model="entry.cost" autofocus :label="$t('maintenance.modal.cost')" />
@@ -45,8 +45,8 @@
const entry = reactive({
id: null as string | null,
name: "",
- completedDate: null as Date | null,
- scheduledDate: null as Date | null,
+ completedDate: "",
+ scheduledDate: "",
description: "",
cost: "",
itemIds: null as string[] | null,
@@ -70,8 +70,8 @@
entry.itemIds.map(async itemId => {
const { error } = await api.items.maintenance.create(itemId, {
name: entry.name,
- completedDate: entry.completedDate ?? "",
- scheduledDate: entry.scheduledDate ?? "",
+ completedDate: entry.completedDate,
+ scheduledDate: entry.scheduledDate,
description: entry.description,
cost: parseFloat(entry.cost) ? entry.cost : "0",
});
@@ -93,10 +93,10 @@
const { error } = await api.maintenance.update(entry.id, {
name: entry.name,
- completedDate: entry.completedDate ?? "null",
- scheduledDate: entry.scheduledDate ?? "null",
+ completedDate: entry.completedDate,
+ scheduledDate: entry.scheduledDate,
description: entry.description,
- cost: entry.cost,
+ cost: parseFloat(entry.cost) ? entry.cost : "0",
});
if (error) {
@@ -113,8 +113,8 @@
case "create":
entry.id = null;
entry.name = "";
- entry.completedDate = null;
- entry.scheduledDate = null;
+ entry.completedDate = "";
+ entry.scheduledDate = "";
entry.description = "";
entry.cost = "";
entry.itemIds = typeof params.itemId === "string" ? [params.itemId] : params.itemId;
@@ -122,8 +122,10 @@
case "update":
entry.id = params.maintenanceEntry.id;
entry.name = params.maintenanceEntry.name;
- entry.completedDate = new Date(params.maintenanceEntry.completedDate);
- entry.scheduledDate = new Date(params.maintenanceEntry.scheduledDate);
+ // Backend already returns YYYY-MM-DD via types.Date — keep as string
+ // so JSON.stringify never converts to a UTC instant.
+ entry.completedDate = (params.maintenanceEntry.completedDate as string) ?? "";
+ entry.scheduledDate = (params.maintenanceEntry.scheduledDate as string) ?? "";
entry.description = params.maintenanceEntry.description;
entry.cost = params.maintenanceEntry.cost;
entry.itemIds = null;
@@ -131,8 +133,8 @@
case "duplicate":
entry.id = null;
entry.name = params.maintenanceEntry.name;
- entry.completedDate = null;
- entry.scheduledDate = null;
+ entry.completedDate = "";
+ entry.scheduledDate = "";
entry.description = params.maintenanceEntry.description;
entry.cost = params.maintenanceEntry.cost;
entry.itemIds = [params.itemId];
diff --git a/frontend/components/Maintenance/ListView.vue b/frontend/components/Maintenance/ListView.vue
index 1b8ae296..6f4a6c00 100644
--- a/frontend/components/Maintenance/ListView.vue
+++ b/frontend/components/Maintenance/ListView.vue
@@ -22,6 +22,7 @@
import Markdown from "~/components/global/Markdown.vue";
import { toast } from "@/components/ui/sonner";
import { useDialog } from "@/components/ui/dialog-provider";
+ import { toDateOnlyString } from "~/lib/datelib/dateOnly";
import { DialogID } from "../ui/dialog-provider/utils";
const maintenanceFilterStatus = ref(MaintenanceFilterStatus.MaintenanceFilterStatusScheduled);
@@ -104,8 +105,10 @@
async function completeEntry(maintenanceEntry: MaintenanceEntry) {
const { error } = await api.maintenance.update(maintenanceEntry.id, {
name: maintenanceEntry.name,
- completedDate: new Date(Date.now()),
- scheduledDate: maintenanceEntry.scheduledDate ?? "null",
+ // Local YYYY-MM-DD — using a Date object would JSON-stringify to UTC and
+ // shift the day for users east of UTC.
+ completedDate: toDateOnlyString(new Date()),
+ scheduledDate: (maintenanceEntry.scheduledDate as string) ?? "",
description: maintenanceEntry.description,
cost: maintenanceEntry.cost,
});
diff --git a/frontend/composables/use-formatters.ts b/frontend/composables/use-formatters.ts
index 04fb644c..cbef77fe 100644
--- a/frontend/composables/use-formatters.ts
+++ b/frontend/composables/use-formatters.ts
@@ -2,6 +2,7 @@ import { format, formatDistance } from "date-fns";
import { reactive } from "vue";
/* eslint import/namespace: ['error', { allowComputed: true }] */
import * as Locales from "date-fns/locale";
+import { isDateOnlyString, parseDateOnly } from "~/lib/datelib/dateOnly";
import { fmtCurrency, fmtCurrencyAsync } from "./utils";
const cache = reactive({
@@ -65,7 +66,17 @@ export function fmtDate(
fmt: DateTimeFormat = "human",
type: DateTimeType = "date"
): string {
- const dt = typeof value === "string" || typeof value === "number" ? new Date(value) : value;
+ // YYYY-MM-DD must be parsed via local components — `new Date("2026-04-17")`
+ // is UTC midnight, which renders as the previous day in any timezone west
+ // of UTC.
+ let dt: Date | null;
+ if (isDateOnlyString(value)) {
+ dt = parseDateOnly(value);
+ } else if (typeof value === "string" || typeof value === "number") {
+ dt = new Date(value);
+ } else {
+ dt = value;
+ }
if (!dt || !validDate(dt)) {
return "";
diff --git a/frontend/lib/api/__test__/user/items.test.ts b/frontend/lib/api/__test__/user/items.test.ts
index 7ee31373..d3dfd9e1 100644
--- a/frontend/lib/api/__test__/user/items.test.ts
+++ b/frontend/lib/api/__test__/user/items.test.ts
@@ -137,8 +137,8 @@ describe("user should be able to create an item and add an attachment", () => {
const { response, data } = await api.items.maintenance.create(item.id, {
name: faker.vehicle.model(),
description: faker.lorem.paragraph(1),
- completedDate: faker.date.past(),
- scheduledDate: "null",
+ completedDate: faker.date.past().toISOString().slice(0, 10),
+ scheduledDate: "",
cost: faker.number.int(100).toString(),
});
diff --git a/frontend/lib/api/__test__/user/stats.test.ts b/frontend/lib/api/__test__/user/stats.test.ts
index 6f10677c..4c3237e1 100644
--- a/frontend/lib/api/__test__/user/stats.test.ts
+++ b/frontend/lib/api/__test__/user/stats.test.ts
@@ -17,13 +17,13 @@ type ImportObj = {
[`HB.notes`]: string;
[`HB.purchase_price`]: number;
[`HB.purchase_from`]: string;
- [`HB.purchase_time`]: string;
+ [`HB.purchase_date`]: string;
[`HB.lifetime_warranty`]: boolean;
[`HB.warranty_expires`]: string;
[`HB.warranty_details`]: string;
[`HB.sold_to`]: string;
[`HB.sold_price`]: number;
- [`HB.sold_time`]: string;
+ [`HB.sold_date`]: string;
[`HB.sold_notes`]: string;
};
@@ -63,12 +63,12 @@ function importFileGenerator(entries: number): ImportObj[] {
[`HB.notes`]: "",
[`HB.purchase_from`]: faker.person.fullName(),
[`HB.purchase_price`]: faker.number.int(100),
- [`HB.purchase_time`]: faker.date.past().toDateString(),
+ [`HB.purchase_date`]: formatDate(faker.date.past()),
[`HB.lifetime_warranty`]: half > i,
[`HB.warranty_details`]: "",
[`HB.sold_to`]: faker.person.fullName(),
[`HB.sold_price`]: faker.number.int(100),
- [`HB.sold_time`]: formatDate(faker.date.past()),
+ [`HB.sold_date`]: formatDate(faker.date.past()),
[`HB.sold_notes`]: "",
});
}
diff --git a/frontend/lib/api/classes/items.ts b/frontend/lib/api/classes/items.ts
index 78f51c4b..11f35172 100644
--- a/frontend/lib/api/classes/items.ts
+++ b/frontend/lib/api/classes/items.ts
@@ -1,5 +1,4 @@
import { BaseAPI, route } from "../base";
-import { parseDate } from "../base/base-api";
import type {
EntityCreate,
EntityListResult,
@@ -122,15 +121,7 @@ export class ItemsApi extends BaseAPI {
}
async get(id: string) {
- const payload = await this.http.get<EntityOut>({ url: route(`/entities/${id}`) });
-
- if (!payload.data) {
- return payload;
- }
-
- // Parse Date Types
- payload.data = parseDate(payload.data, ["purchaseTime", "soldTime", "warrantyExpires"]);
- return payload;
+ return this.http.get<EntityOut>({ url: route(`/entities/${id}`) });
}
delete(id: string) {
@@ -138,30 +129,17 @@ export class ItemsApi extends BaseAPI {
}
async update(id: string, item: EntityUpdate) {
- const payload = await this.http.put<EntityCreate, EntityOut>({
+ return this.http.put<EntityCreate, EntityOut>({
url: route(`/entities/${id}`),
body: this.dropFields(item),
});
- if (!payload.data) {
- return payload;
- }
-
- payload.data = parseDate(payload.data, ["purchaseTime", "soldTime", "warrantyExpires"]);
- return payload;
}
async patch(id: string, item: EntityPatch) {
- const resp = await this.http.patch<EntityPatch, EntityOut>({
+ return this.http.patch<EntityPatch, EntityOut>({
url: route(`/entities/${id}`),
body: this.dropFields(item),
});
-
- if (!resp.data) {
- return resp;
- }
-
- resp.data = parseDate(resp.data, ["purchaseTime", "soldTime", "warrantyExpires"]);
- return resp;
}
async duplicate(
@@ -208,7 +186,9 @@ export class ItemsApi extends BaseAPI {
// =========================================================================
async getLocations(q: LocationsQuery = { filterChildren: false }) {
- const resp = await this.http.get<{ items: EntitySummary[] }>({ url: route("/entities", { ...q, isLocation: true }) });
+ const resp = await this.http.get<{ items: EntitySummary[] }>({
+ url: route("/entities", { ...q, isLocation: true }),
+ });
// Unwrap paginated response to flat array for backward compat
return {
...resp,
diff --git a/frontend/lib/api/types/data-contracts.ts b/frontend/lib/api/types/data-contracts.ts
index 8fc06bc1..1a869f98 100644
--- a/frontend/lib/api/types/data-contracts.ts
+++ b/frontend/lib/api/types/data-contracts.ts
@@ -170,22 +170,22 @@ export interface EntEntity {
name: string;
/** Notes holds the value of the "notes" field. */
notes: string;
+ /** PurchaseDate holds the value of the "purchase_date" field. */
+ purchase_date: Date | string;
/** PurchaseFrom holds the value of the "purchase_from" field. */
purchase_from: string;
/** PurchasePrice holds the value of the "purchase_price" field. */
purchase_price: number;
- /** PurchaseTime holds the value of the "purchase_time" field. */
- purchase_time: string;
/** Quantity holds the value of the "quantity" field. */
quantity: number;
/** SerialNumber holds the value of the "serial_number" field. */
serial_number: string;
+ /** SoldDate holds the value of the "sold_date" field. */
+ sold_date: Date | string;
/** SoldNotes holds the value of the "sold_notes" field. */
sold_notes: string;
/** SoldPrice holds the value of the "sold_price" field. */
sold_price: number;
- /** SoldTime holds the value of the "sold_time" field. */
- sold_time: string;
/** SoldTo holds the value of the "sold_to" field. */
sold_to: string;
/** SyncChildEntityLocations holds the value of the "sync_child_entity_locations" field. */
@@ -640,16 +640,16 @@ export interface EntityOut {
notes: string;
/** Edges */
parent?: EntitySummary | null;
+ /** Purchase */
+ purchaseDate: Date | string;
purchaseFrom: string;
purchasePrice: number;
- /** Purchase */
- purchaseTime: Date | string;
quantity: number;
serialNumber: string;
+ /** Sold */
+ soldDate: Date | string;
soldNotes: string;
soldPrice: number;
- /** Sold */
- soldTime: Date | string;
soldTo: string;
syncChildEntityLocations: boolean;
tags: TagSummary[];
@@ -692,7 +692,7 @@ export interface EntitySummary {
purchasePrice: number;
quantity: number;
/** Sale details */
- soldTime: Date | string;
+ soldDate: Date | string;
tags: TagSummary[];
thumbnailId?: string | null;
updatedAt: Date | string;
@@ -852,18 +852,18 @@ export interface EntityUpdate {
/** Extras */
notes: string;
parentId?: string | null;
+ /** Purchase */
+ purchaseDate: Date | string;
/** @maxLength 255 */
purchaseFrom: string;
purchasePrice?: number | null;
- /** Purchase */
- purchaseTime: Date | string;
quantity: number;
/** Identifications */
serialNumber: string;
+ /** Sold */
+ soldDate: Date | string;
soldNotes: string;
soldPrice?: number | null;
- /** Sold */
- soldTime: Date | string;
/** @maxLength 255 */
soldTo: string;
syncChildEntityLocations: boolean;
diff --git a/frontend/lib/datelib/dateOnly.test.ts b/frontend/lib/datelib/dateOnly.test.ts
new file mode 100644
index 00000000..9129202b
--- /dev/null
+++ b/frontend/lib/datelib/dateOnly.test.ts
@@ -0,0 +1,92 @@
+import { describe, expect, test } from "vitest";
+import { isDateOnlyString, parseDateOnly, toDateOnlyString } from "./dateOnly";
+
+describe("isDateOnlyString", () => {
+ test("matches YYYY-MM-DD", () => {
+ expect(isDateOnlyString("2026-04-17")).toBe(true);
+ });
+ test("rejects timestamps and junk", () => {
+ expect(isDateOnlyString("2026-04-17T22:00:00.000Z")).toBe(false);
+ expect(isDateOnlyString("2026/04/17")).toBe(false);
+ expect(isDateOnlyString("")).toBe(false);
+ expect(isDateOnlyString(null as unknown as string)).toBe(false);
+ });
+});
+
+describe("toDateOnlyString", () => {
+ test("passes YYYY-MM-DD through unchanged", () => {
+ expect(toDateOnlyString("2026-04-17")).toBe("2026-04-17");
+ });
+
+ test("uses LOCAL components for Date objects (no UTC shift)", () => {
+ // April 18 00:00 in the local timezone — the canonical value emitted by
+ // VueDatePicker. Used to be ISO-stringified to '2026-04-17T22:00:00Z' in
+ // UTC+2 and saved a day early on the backend; must now produce
+ // '2026-04-18' regardless of timezone.
+ const d = new Date(2026, 3, 18);
+ expect(toDateOnlyString(d)).toBe("2026-04-18");
+ });
+
+ test("returns empty string for nullish/zero values", () => {
+ expect(toDateOnlyString(null)).toBe("");
+ expect(toDateOnlyString(undefined)).toBe("");
+ expect(toDateOnlyString("")).toBe("");
+ const zero = new Date();
+ zero.setFullYear(1);
+ expect(toDateOnlyString(zero)).toBe("");
+ });
+
+ test("normalizes ISO timestamps via local components", () => {
+ // Pick a Date from an ISO string and re-extract — the returned date must
+ // reflect what the user *sees* locally, not the underlying UTC instant.
+ const iso = new Date(2026, 3, 18, 9, 30).toISOString();
+ expect(toDateOnlyString(iso)).toBe("2026-04-18");
+ });
+});
+
+describe("parseDateOnly", () => {
+ test("constructs a Date from local components", () => {
+ const d = parseDateOnly("2026-04-18");
+ expect(d).not.toBeNull();
+ expect(d!.getFullYear()).toBe(2026);
+ expect(d!.getMonth()).toBe(3);
+ expect(d!.getDate()).toBe(18);
+ expect(d!.getHours()).toBe(0);
+ });
+
+ test("returns null for invalid input", () => {
+ expect(parseDateOnly("")).toBeNull();
+ expect(parseDateOnly(null)).toBeNull();
+ expect(parseDateOnly("2026-04-17T22:00:00Z")).toBeNull();
+ expect(parseDateOnly("not a date")).toBeNull();
+ });
+
+ test("returns null for impossible calendar dates (no JS rollover)", () => {
+ // Day overflow — JS would roll these into the next month.
+ expect(parseDateOnly("2026-02-30")).toBeNull();
+ expect(parseDateOnly("2026-04-31")).toBeNull();
+ // Non-leap Feb 29 — JS would roll into March 1.
+ expect(parseDateOnly("2025-02-29")).toBeNull();
+ // Month out of range — JS would roll into next/prev year.
+ expect(parseDateOnly("2026-13-01")).toBeNull();
+ expect(parseDateOnly("2026-00-15")).toBeNull();
+ // Day = 0 — JS would land on the last day of the previous month.
+ expect(parseDateOnly("2026-04-00")).toBeNull();
+ });
+
+ test("accepts genuine leap-year Feb 29", () => {
+ const d = parseDateOnly("2024-02-29");
+ expect(d).not.toBeNull();
+ expect(d!.getFullYear()).toBe(2024);
+ expect(d!.getMonth()).toBe(1);
+ expect(d!.getDate()).toBe(29);
+ });
+});
+
+describe("Date object round-trip preserves the calendar day", () => {
+ test("toDateOnlyString(parseDateOnly(s)) === s", () => {
+ for (const s of ["2020-01-01", "2024-02-29", "2026-04-18", "2026-12-31"]) {
+ expect(toDateOnlyString(parseDateOnly(s))).toBe(s);
+ }
+ });
+});
diff --git a/frontend/lib/datelib/dateOnly.ts b/frontend/lib/datelib/dateOnly.ts
new file mode 100644
index 00000000..ae08fad0
--- /dev/null
+++ b/frontend/lib/datelib/dateOnly.ts
@@ -0,0 +1,57 @@
+// Date-only helpers for fields that represent a calendar date with no
+// time-of-day or timezone semantics (e.g. purchaseDate, scheduledDate).
+//
+// The frontend must keep these fields as YYYY-MM-DD strings end-to-end. A JS
+// Date object always carries a UTC instant, and JSON.stringify uses UTC, so
+// passing Dates across the API boundary causes the day to shift for every
+// user not on UTC. Use these helpers at the picker/display boundary instead.
+
+const DATE_ONLY_RE = /^\d{4}-\d{2}-\d{2}$/;
+
+export function isDateOnlyString(value: unknown): value is string {
+ return typeof value === "string" && DATE_ONLY_RE.test(value);
+}
+
+// toDateOnlyString returns YYYY-MM-DD using LOCAL year/month/day components.
+// Anything else (zero/empty/null/invalid) collapses to "".
+export function toDateOnlyString(value: Date | string | null | undefined): string {
+ if (value == null || value === "") return "";
+
+ if (typeof value === "string") {
+ if (isDateOnlyString(value)) return value;
+ // Tolerate ISO timestamps coming from older code paths — interpret in
+ // local time so the visible day is preserved.
+ const d = new Date(value);
+ if (isNaN(d.getTime()) || d.getFullYear() < 1000) return "";
+ return formatLocal(d);
+ }
+
+ if (value instanceof Date) {
+ if (isNaN(value.getTime()) || value.getFullYear() < 1000) return "";
+ return formatLocal(value);
+ }
+
+ return "";
+}
+
+// parseDateOnly turns YYYY-MM-DD into a Date constructed from LOCAL
+// components, so the resulting Date's local getters return the same Y/M/D.
+// Returns null for shape mismatches and for impossible calendar dates
+// (e.g. "2026-02-30", "2026-13-01", "2025-02-29") — JS Date silently
+// rolls those over, so we verify the parsed components round-trip.
+export function parseDateOnly(value: string | null | undefined): Date | null {
+ if (!value || !isDateOnlyString(value)) return null;
+ const [y, m, d] = value.split("-").map(n => parseInt(n, 10)) as [number, number, number];
+ const date = new Date(y, m - 1, d);
+ if (date.getFullYear() !== y || date.getMonth() !== m - 1 || date.getDate() !== d) {
+ return null;
+ }
+ return date;
+}
+
+function formatLocal(d: Date): string {
+ const y = d.getFullYear().toString().padStart(4, "0");
+ const m = (d.getMonth() + 1).toString().padStart(2, "0");
+ const day = d.getDate().toString().padStart(2, "0");
+ return `${y}-${m}-${day}`;
+}
diff --git a/frontend/pages/item/[id]/index.vue b/frontend/pages/item/[id]/index.vue
index f0950fc3..305039a7 100644
--- a/frontend/pages/item/[id]/index.vue
+++ b/frontend/pages/item/[id]/index.vue
@@ -371,7 +371,7 @@
if (preferences.value.showEmpty) {
return true;
}
- return item.value?.purchaseFrom || item.value?.purchasePrice !== 0 || validDate(item.value?.purchaseTime);
+ return item.value?.purchaseFrom || item.value?.purchasePrice !== 0 || validDate(item.value?.purchaseDate);
});
const purchaseDetails = computed<Details>(() => {
@@ -387,7 +387,7 @@
},
{
name: "items.purchase_date",
- text: item.value?.purchaseTime || "",
+ text: item.value?.purchaseDate || "",
type: "date",
date: true,
},
@@ -404,7 +404,7 @@
if (preferences.value.showEmpty) {
return true;
}
- return item.value?.soldTo || item.value?.soldPrice !== 0 || validDate(item.value?.soldTime);
+ return item.value?.soldTo || item.value?.soldPrice !== 0 || validDate(item.value?.soldDate);
});
const soldDetails = computed<Details>(() => {
@@ -420,7 +420,7 @@
},
{
name: "items.sold_at",
- text: item.value?.soldTime || "",
+ text: item.value?.soldDate || "",
type: "date",
date: true,
},
@@ -598,8 +598,8 @@
item.value.lifetimeWarranty ||
item.value.warrantyExpires
),
- includePurchaseFields: !!(item.value.purchaseFrom || item.value.purchasePrice || item.value.purchaseTime),
- includeSoldFields: !!(item.value.soldTo || item.value.soldPrice || item.value.soldTime),
+ includePurchaseFields: !!(item.value.purchaseFrom || item.value.purchasePrice || item.value.purchaseDate),
+ includeSoldFields: !!(item.value.soldTo || item.value.soldPrice || item.value.soldDate),
fields: item.value.fields.map(field => ({
id: NIL_UUID,
name: field.name,
diff --git a/frontend/pages/item/[id]/index/edit.vue b/frontend/pages/item/[id]/index/edit.vue
index a23503fe..5308ef0a 100644
--- a/frontend/pages/item/[id]/index/edit.vue
+++ b/frontend/pages/item/[id]/index/edit.vue
@@ -115,7 +115,9 @@
assetId: item.value.assetId,
purchasePrice,
soldPrice,
- purchaseTime: item.value.purchaseTime as Date,
+ // Date-only fields stay as YYYY-MM-DD strings — see types.Date on the
+ // backend. The form/picker hold strings; sending the spread above is
+ // sufficient.
syncChildEntityLocations: item.value.syncChildEntityLocations,
};
@@ -242,7 +244,7 @@
{
type: "date",
label: "items.purchase_date",
- ref: "purchaseTime",
+ ref: "purchaseDate",
},
];
@@ -280,7 +282,7 @@
{
type: "date",
label: "items.sold_at",
- ref: "soldTime",
+ ref: "soldDate",
},
];
@@ -636,6 +638,7 @@
v-else-if="field.type === 'date'"
v-model="item[field.ref]"
:label="$t(field.label)"
+ date-only
inline
/>
<FormCheckbox
@@ -798,6 +801,7 @@
v-else-if="field.type === 'date'"
v-model="item[field.ref]"
:label="$t(field.label)"
+ date-only
inline
/>
<FormCheckbox
@@ -846,6 +850,7 @@
v-else-if="field.type === 'date'"
v-model="item[field.ref]"
:label="$t(field.label)"
+ date-only
inline
/>
<FormCheckbox
@@ -894,6 +899,7 @@
v-else-if="field.type === 'date'"
v-model="item[field.ref]"
:label="$t(field.label)"
+ date-only
inline
/>
<FormCheckbox
diff --git a/frontend/pages/location/[id]/index/edit.vue b/frontend/pages/location/[id]/index/edit.vue
index 818dd8df..7d2640f8 100644
--- a/frontend/pages/location/[id]/index/edit.vue
+++ b/frontend/pages/location/[id]/index/edit.vue
@@ -97,7 +97,7 @@
assetId: item.value.assetId,
purchasePrice: item.value.purchasePrice || 0,
soldPrice: item.value.soldPrice || 0,
- purchaseTime: item.value.purchaseTime as Date,
+ // Date-only fields stay as YYYY-MM-DD strings via the spread above.
syncChildEntityLocations: item.value.syncChildEntityLocations,
};