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.
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.