Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ganigeorgiev/date
Small Go package that defines a struct, representing a date as in ISO 8601 (eg. 2006-01-02).
https://github.com/ganigeorgiev/date
date go golang-package
Last synced: about 2 months ago
JSON representation
Small Go package that defines a struct, representing a date as in ISO 8601 (eg. 2006-01-02).
- Host: GitHub
- URL: https://github.com/ganigeorgiev/date
- Owner: ganigeorgiev
- License: bsd-3-clause
- Created: 2020-11-19T18:18:15.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-03T15:10:13.000Z (about 4 years ago)
- Last Synced: 2024-10-25T03:09:21.051Z (3 months ago)
- Topics: date, go, golang-package
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Date
[![Go Report Card](https://goreportcard.com/badge/github.com/ganigeorgiev/date)](https://goreportcard.com/report/github.com/ganigeorgiev/date)
[![GoDoc](https://godoc.org/github.com/ganigeorgiev/date?status.svg)](https://pkg.go.dev/github.com/ganigeorgiev/date)
================================================================================Date is a small Go package that defines a `date.Date` struct, representing a date as in **ISO 8601** (eg. `2006-01-02`).
The package was created primarily to scan SQL `DATE` type and other date-only values.
Under the hood, each date is stored as `time.Time` instant with _zero time part_ in UTC (eg. `2006-01-02 00:00:00:00 UTC`).
As a result, many of the `date.Date` methods are implemented using the corresponding methods of `time.Time`.> There is an active proposal for something similar to be implemented in the standard library - [golang/go#19700](https://github.com/golang/go/issues/19700)
## Installation
```
go get github.com/ganigeorgiev/date
```Example usage:
```go
import github.com/ganigeorgiev/datetype User struct {
JoinDate date.Date
}
```See the [package documentation](https://pkg.go.dev/github.com/ganigeorgiev/date) for more details and examples.