package main
import (
"fmt"
"time"
)
type SyncState string
type SyncRequest struct {
ID string `json:"i"`
State SyncState `json:"s"`
ExpiresAt time.Time `json:"e"`
}
func main() {
timeStr := "2023-10-26T15:04:05Z"
parsedTime1, _ := time.Parse(time.RFC3339, timeStr)
parsedTime2, _ := time.Parse(time.RFC3339, timeStr)
sr1 := SyncRequest{
ID: "1",
State: "active",
ExpiresAt: parsedTime1,
}
sr2 := SyncRequest{
ID: "1",
State: "active",
ExpiresAt: parsedTime2,
}
fmt.Printf("Are sr1 and sr2 equal? %v\n", sr1 == sr2)
sr2.ExpiresAt = parsedTime2.Add(1 * time.Second)
fmt.Printf("After modifying ExpiresAt, are sr1 and sr2 equal? %v\n", sr1 == sr2)
}
To embed this program on your website, copy the following code and paste it into your website's HTML: