Skip to content

The package provides an easy-to-use date type with some helpers.

License

Notifications You must be signed in to change notification settings

kaatinga/bublyk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tests GitHub release MIT license codecov lint workflow help wanted

bublyk

The package introduces the Date type, specifically designed for instances where only the date in UTC location is required, without the need for time details. In comparison to the time.Time type, Date offers several advantages:

  • It consumes significantly less memory.
  • It eliminates the need for boilerplate code when working with dates.
  • It allows for straightforward comparisons using operators such as >, <, and others.

Usage

package main

import (
	"fmt"
	"time"

	"github.com/kaatinga/bublyk"
)

func main() {
	// Create a new Date instance
	date := bublyk.Now()

	// Print the current date
	fmt.Println(date)

	// Create a new Date instance from a time.Time instance
	var t = time.Now()
	date2 := bublyk.NewDateFromTime(&t)

	// Print the current date
	fmt.Println(date2)

	// Compare two Date instances
	fmt.Println(date > date2)
}

Will be happy to everyone who want to participate in the work on the bublyk package.