Change Now() and DefaultClock to use UTC instead of local time
Changed quando.Now() and DefaultClock.Now() to return dates in UTC
timezone instead of local server timezone. This aligns with industry
standards for date/time libraries and prevents server-timezone-dependent
behavior.
Changes:
- date.go: Now() uses time.Now().UTC() instead of time.Now()
- Updated documentation comments to reflect UTC default
- date_test.go: TestNow() now verifies UTC location
- clock_test.go: TestDefaultClock_Now() now verifies UTC location
- parse_test.go: TestParseRelative() verifies all results are UTC
- parse.go: Updated comment from "local timezone" to "UTC timezone"
Users needing local time can use:
- quando.From(time.Now()) for explicit local time
- quando.Now().In("Europe/Berlin") to convert to specific timezone
Closes: quando-67n
This commit is contained in:
parent
f8c486132d
commit
f47897f3fd
6 changed files with 46 additions and 10 deletions
4
date.go
4
date.go
|
|
@ -70,14 +70,14 @@ type Date struct {
|
|||
}
|
||||
|
||||
// Now returns a Date representing the current moment in time.
|
||||
// The Date uses the local timezone by default.
|
||||
// The Date uses the UTC timezone by default.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// now := quando.Now()
|
||||
func Now() Date {
|
||||
return Date{
|
||||
t: time.Now(),
|
||||
t: time.Now().UTC(),
|
||||
lang: EN, // Default language
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue