A Go package for working with dates

date

GoDoc Build Status Coverage Status

Package date provides functionality for working with dates.

This package introduces a light-weight Date type that is storage-efficient and covenient for calendrical calculations and date parsing and formatting (including years outside the [0,9999] interval).

See package documentation for full documentation and examples.

Installation

go get -u github.com/fxtlabs/date

Credits

This package follows very closely the design of package time in the standard library; many of the Date methods are implemented using the corresponding methods of the time.Time type and much of the documentation is copied directly from that package.

Similar Resources

Convert dates from or to 31 calendars in Go. Implements the functions discussed in Reingold/Dershowitz 2018.

libcalcal - Calendrical calculations in Go About libcalcal implements in Go the functions described and presented in: Reingold, Edward M., and Nachum

Dec 30, 2021

Go package providing opinionated tools and methods for working with the `aws-sdk-go/service/cloudfront` package.

go-aws-cloudfront Go package providing opinionated tools and methods for working with the aws-sdk-go/service/cloudfront package. Documentation Tools $

Feb 2, 2022

go.rice is a Go package that makes working with resources such as html,js,css,images,templates, etc very easy.

go.rice go.rice is a Go package that makes working with resources such as html,js,css,images and templates easy. During development go.rice will load

Dec 29, 2022

A Go filesystem package for working with files and directories

Stowage A Go filesystem package for working with files and directories, it features a simple API with support for the common files and directories ope

May 28, 2021

Yet another Go package for working with *.golden test files, with a focus on simplicity.

go-golden Yet another Go package for working with *.golden test files, with a focus on simplicity. Import import "github.com/jimeh/go-golden" Usage fu

Aug 3, 2022

Go package providing tools for working with Library of Congress data.

go-libraryofcongress Go package providing tools for working with Library of Congress data. Documentation Tools $ make cli go build -mod vendor -o bin

Jan 3, 2023

Go package for working with Library of Congress data in an SFO Museum context.

go-sfomuseum-libraryofcongress Go package for working with Library of Congress data in an SFO Museum context. Documentation Documentation is incomplet

Oct 19, 2021

This is an experimental package for working with JSON-LD documents in Go

JSON-LD 🔗 Simple JSON-LD in Go This is an experimental package for working with JSON-LD documents in Go. Experimental, Pre-Alpha Quality Please do no

Jul 6, 2022

A golang package for comparing and working with k0s version numbers

version A go-language package for managing k0s version numbers. It is based on hashicorp/go-version but adds sorting and comparison capabilities for t

Feb 7, 2022

Types and utilities for working with 2d geometry in Golang

orb Package orb defines a set of types for working with 2d geo and planar/projected geometric data in Golang. There are a set of sub-packages that use

Dec 28, 2022

General purpose library for reading, writing and working with OpenStreetMap data

osm This package is a general purpose library for reading, writing and working with OpenStreetMap data in Go (golang). It has the ability to read OSM

Dec 30, 2022

General purpose library for reading, writing and working with OpenStreetMap data

osm This package is a general purpose library for reading, writing and working with OpenStreetMap data in Go (golang). It has the ability to read OSM

Dec 30, 2022

A library for working with IP addresses and networks in Go

IPLib I really enjoy Python's ipaddress library and Ruby's ipaddr, I think you can write a lot of neat software if some of the little problems around

Dec 20, 2022

Utilities for working with discrete probability distributions and other tools useful for doing NLP work

GNLP A few structures for doing NLP analysis / experiments. Basics counter.Counter A map-like data structure for representing discrete probability dis

Nov 28, 2022

Types and utilities for working with 2d geometry in Golang

orb Package orb defines a set of types for working with 2d geo and planar/projected geometric data in Golang. There are a set of sub-packages that use

Dec 28, 2022

tools for working with streams of data

streamtools 4/1/2015 Development for streamtools has waned as our attention has turned towards developing a language paradigm that embraces blocking,

Nov 18, 2022

A GO API library for working with Marathon

Go-Marathon Go-marathon is a API library for working with Marathon. It currently supports Application and group deployment Helper filters for pulling

Dec 28, 2022
Comments
  • database/sql support

    database/sql support

    When using the date.Date type with the database/sql package, I get errors like error: scanning database row: sql: Scan error on column index 3: unsupported Scan, storing driver.Value type time.Time into type *date.Date or Unable to encode value 2019-01-02

    This can be easily solved by implementing both the driver.Valuer and sql.Scanner interfaces.

  • time.Date normalization

    time.Date normalization

    Hi, the Go function time.Date() have the normalization feature "built-in", so with incorrect input (like 31/04/2018 or 32/02/2018) we get a date, but not the expected one. Since the time.Date() function does not return any error, this behaviour can be acceptable. But in your library (https://github.com/rickb777/date) the ParseISO() function return an error and so I prefer to get just an error instead of a wrong (but well formatted) result with the previous inputs.

    So, just in case this is useful even to others, we can get an error in ParseISO() adding (in file parse.go line 149):

    	_, err = time.Parse("2006-01-02", abs[:dash1] + "-" + abs[fm1:fm2] + "-" + abs[fd1:])
    	if err != nil {
    		return Date{}, err
    	}
    
    	t := time.Date(year, time.Month(month), day, 0, 0, 0, 0, time.UTC)
    

    Thanks Michele

Related tags
Go package for calculating the sunrise and sunset times for a given location

go-sunrise Go package for calculating the sunrise and sunset times for a given location based on this method. Usage To calculate sunrise and sunset ti

Dec 13, 2022
Golang package to manipulate time intervals.

timespan timespan is a Go library for interacting with intervals of time, defined as a start time and a duration. Documentation API Installation Insta

Sep 26, 2022
timeutil - useful extensions (Timedelta, Strftime, ...) to the golang's time package

timeutil - useful extensions to the golang's time package timeutil provides useful extensions (Timedelta, Strftime, ...) to the golang's time package.

Dec 22, 2022
Go's missing DateTime package

Go's standard library contains a single date package - time. The type provided by it, Time, contains date, time and location information.

Nov 19, 2022
A simple, semantic and developer-friendly golang package for datetime

Carbon 中文 | English carbon 是一个轻量级、语义化、对开发者友好的 Golang 时间处理库,支持链式调用和 gorm、xorm、zorm 等主流 orm。 如果您觉得不错,请给个 star 吧 github:github.com/golang-module/carbon g

Jan 9, 2023
Structural time package for jalali calendar

Jalali Structural time package for jalali calendar. This package support parse from string, json and time. Structures There are three data structures

Mar 21, 2022
Timediff is a Go package for printing human readable, relative time differences 🕰️

timediff is a Go package for printing human readable, relative time differences. Output is based on ranges defined in the Day.js JavaScript library, and can be customized if needed.

Dec 25, 2022
A Go package for working with dates

date Package date provides functionality for working with dates. This package introduces a light-weight Date type that is storage-efficient and coveni

May 24, 2022
CSPFinder is a tool to compare ROI of selling Cash Secure Put options between different tickers for different expiry dates.

CSPFinder is a tool to compare ROI of selling Cash Secure Put options between different tickers for different expiry dates. It is intended to help open new cash secured put positions.

Dec 21, 2021
A simple cli tool to convert unix timestamps or human readable dates.

now A simple cli tool to convert unix timestamps or human readable dates. Install go install github.com/gloomyzerg/now Usage now #output now unix time

Nov 23, 2021