Giter VIP home page Giter VIP logo

go-nepali's People

Contributors

aj3sh avatar subashcs avatar sugat009 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

go-nepali's Issues

Implement CLI for date conversion

Let's implement CLI for date conversion, English to Nepali (AD to BS), and Nepali to English (BS to AD).

An example of a CLI would be:

ad2bs 2023-04-29
# Output: 2080-01-16

bs2ad 2080-01-16
# Output: 2023-04-29

Refactor dateConverter code with one single reference point

In our current date converter code, we are using different reference points of date. The reference points are 2000/01/01 BS with 1943/4/14 AD and 1944/01/01 AD with 2000/09/17 BS. They are used inside the code as they are hard-coded.

With this, the maintainability of the code gets difficult. So the solution is to use one reference point of date, 2000/01/01 BS with 1943/4/14 AD which should be easily changeable in the future.

Invalid date conversion!

Run the following code

package main

import (
	"fmt"

	"github.com/opensource-nepal/go-nepali/dateConverter"
)

type AD struct {
	year  int
	month int
	day   int
}

func main() {
	ads := []AD{
		{2024, 6, 13},
		{2024, 6, 14},
	}
	for _, ad := range ads {
		bs, err := dateConverter.EnglishToNepali(ad.year, ad.month, ad.day)
		if err != nil {
			panic(err)
		}
		fmt.Printf("%v-%v-%v-AD\n", ad.year, ad.month, ad.day)
		fmt.Printf("%v-%v-%v-BS\n", bs[0], bs[1], bs[2])
		fmt.Printf("\n\n")
	}
}

and you'll get as output

2024-6-13-AD
2081-2-31-BS


2024-6-14-AD
2081-3-1-BS

Note that conversion of 2024-6-13-AD is correct while the next day is not! 2024-6-14-AD should be 2081-2-32-BS!

image

Upgrade go version

The current version for this project has been set to 1.19. Let's upgrade the go version to the latest.

Remove absolute imports

Remove the absolute imports from the source code.

Eg: https://github.com/orgs/opensource-nepal/go-nepali/dateConverter

Support GO parsing and formatting layout

Add support for GO like Parse and Format layouts (date and time format).

Eg.

const layout = "Jan 2, 2006 at 3:04pm (MST)"
tm, _ := time.Parse(layout, "Feb 4, 2014 at 6:05pm (PST)")
tm.Format("2006-02-01")

Improve documentation

The current documentation is weak and do not covers all the features of nepalitime.

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.