This commit is contained in:
2023-03-30 08:44:58 +02:00
parent bf6453b963
commit 0ae5730e7f
17 changed files with 305 additions and 44 deletions

View File

@@ -1,6 +1,7 @@
package ocss
import (
"encoding/json"
"fmt"
"time"
)
@@ -31,6 +32,22 @@ func (t JSONTime) MarshalJSON() ([]byte, error) {
return []byte(stamp), nil
}
func (t *JSONTime) UnmarshalJSON(b []byte) error {
var timestamp int64
err := json.Unmarshal(b, &timestamp)
if err != nil {
return err
}
parsed := time.Unix(timestamp, 0)
if err != nil {
return err
}
jsontime := JSONTime(parsed)
*t = jsontime
return nil
}
type JourneySchedule struct {
ID *string `json:"id,omitempty"`
PassengerPickupDate JSONTime `json:"passengerPickupDate"`