@@ -19,8 +19,8 @@ The `utc` package provides an enhanced alias of Go's `time.Time` that ensures yo
1919# # Features
2020
2121- Guaranteed UTC time handling
22- - JSON marshaling/unmarshaling support
23- - SQL database compatibility
22+ - JSON marshaling/unmarshaling support with flexible parsing
23+ - SQL database compatibility with enhanced type support
2424- Automatic timezone handling (PST/PDT, EST/EDT, etc.)
2525- Extensive formatting options:
2626 - US date formats (MM/DD/YYYY)
@@ -29,6 +29,10 @@ The `utc` package provides an enhanced alias of Go's `time.Time` that ensures yo
2929 - Common components (weekday, month, etc.)
3030- Timezone conversion methods with fallback support
3131- Full compatibility with Go' s standard `time.Time` methods
32+ - Nil-safe operations that return errors instead of panicking
33+ - Debug mode with detailed logging for development
34+ - Text encoding support for broader codec compatibility
35+ - Unix timestamp helpers and day boundary utilities
3236
3337## Installation
3438
@@ -38,6 +42,8 @@ To install the `utc` package, use the following command:
3842go get github.com/agentstation/utc
3943```
4044
45+ **Requirements**: Go 1.18 or later (uses `any` type and other modern Go features)
46+
4147## Usage
4248
43491. Import the package:
@@ -109,6 +115,45 @@ type Record struct {
109115}
110116```
111117
118+ ## Debug Mode
119+
120+ The package includes a debug mode that helps identify potential bugs during development:
121+
122+ ```sh
123+ # Build with debug mode enabled
124+ go build -tags debug
125+
126+ # Run tests with debug mode
127+ go test -tags debug ./...
128+ ```
129+
130+ When debug mode is enabled, the package logs warnings when methods are called on nil receivers:
131+
132+ ```
133+ [UTC DEBUG] 2024/01/02 15:04:05 debug.go:26: String() called on nil *Time receiver
134+ [UTC DEBUG] 2024/01/02 15:04:05 debug.go:26: Value() called on nil *Time receiver
135+ ```
136+
137+ ## Additional Utilities
138+
139+ The package includes several convenience methods:
140+
141+ ```go
142+ // Unix timestamp conversions
143+ t1 := utc.FromUnix(1704199445) // From Unix seconds
144+ t2 := utc.FromUnixMilli(1704199445000) // From Unix milliseconds
145+ seconds := t.Unix() // To Unix seconds
146+ millis := t.UnixMilli() // To Unix milliseconds
147+
148+ // Day boundaries
149+ start := t.StartOfDay() // 2024-01-02 00:00:00.000000000 UTC
150+ end := t.EndOfDay() // 2024-01-02 23:59:59.999999999 UTC
151+
152+ // Generic timezone conversion
153+ eastern, err := t.In("America/New_York")
154+ tokyo, err := t.In("Asia/Tokyo")
155+ ```
156+
112157<!-- gomarkdoc:embed:start -->
113158
114159<!-- Code generated by gomarkdoc. DO NOT EDIT -->
0 commit comments