Coder Social home page Coder Social logo

go-saka's Introduction

Go Reference Go

Saka

Saka is a Go library for working with the Balinese calendar system. This library provides functionalities to convert Gregorian dates to Balinese calendar dates and vice versa. It also offers features to retrieve Hindu holidays, important cultural events, and auspicious days.

Installation

To use Saka in your Go project, you need to install it using go get:

go get -u go.portalnesia.com/saka

Usage

package main

import (
	"fmt"
	"time"
	"github.com/golang-module/carbon"
	"go.portalnesia.com/saka"
)

func oneDate() {
	sakaInstance := saka.New()

	// Get information about the date
	fmt.Println("Eka Wara", sakaInstance.EkaWara)
	fmt.Println("Panca Wara", sakaInstance.PancaWara)
	fmt.Println("Sasih", sakaInstance.Sasih)

	// and others...

	allRahinan := sakaInstance.Rahinan()
	for _, rahinan := range allRahinan {
		// todo with list rahinan
		if rahinan == saka.Enum.Rahinan.Nyepi {

		}
	}

}

func rangeDate() {
	d1 := carbon.CreateFromDate(2023, 8, 27)
	d2 := carbon.CreateFromDate(2023, 8, 31)

	sakaInstance, _ := saka.NewRange(d1, d2)

	// List all rahinan in range d1 - d2
	allRahinan := sakaInstance.ListAllRahinan()
	for _, r := range allRahinan {
		fmt.Println(r.Name)
	}

	// List by date
	sakaList := sakaInstance.ListByDate()
	for _, s := range sakaList {
		fmt.Printf("Rahinan for %s\n", s.Time().Format(time.RFC3339))

		for _, r := range s.Rahinan() {
			fmt.Println(r.Name)
		}
		
		fmt.Println()
	}
}

Go Reference

pkg.go.dev/go.portalnesia.com/saka

Thanks To

go-saka's People

Contributors

putuadityabayu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.