Skip to main content

Convert Gregorian date to Kollavarsham date and vice versa

Project description

kollavarsham

Circle CI Status Coverage Status GitHub Actions Status FOSSA Status

Convert Gregorian date to Kollavarsham date and vice versa

Install

TypeScript/JavaScript/Node.js NPM version

$ npm install kollavarsham

Python PyPI version

$ pip install kollavarsham

Go Go project version

go get github.com/kollavarsham/kollavarsham-go/converter

Java Maven version

<dependency>
  <groupId>org.kollavarsham.converter</groupId>
  <artifactId>kollavarsham-converter</artifactId>
  <version>2.0.1</version>
</dependency>

C#/dotnet NuGet version

$ dotnet add package KollavarshamOrg.Converter

Usage

Refer the samples repository for working examples.

TypeScript/JavaScript/Node.js

import { Kollavarsham } from 'kollavarsham';

const options = {
  system: 'SuryaSiddhanta',
  latitude: 10,
  longitude: 76.2
};

const kollavarsham = new Kollavarsham(options);

const today = kollavarsham.fromGregorianDate(new Date());

console.log(today.year, today.mlMasaName, today.date, `(${today.mlNaksatraName})`);

Python

import datetime
import pytz
import kollavarsham

now = pytz.utc.localize(datetime.datetime.utcnow())
kv = kollavarsham.Kollavarsham(latitude=10, longitude=76.2, system="SuryaSiddhanta")

today = kv.from_gregorian_date(date=now)
print(today.year, today.ml_masa_name, today.date, '(' + today.naksatra.ml_malayalam + ')')

Go

package main

import (
	"fmt"
	"time"

	"github.com/kollavarsham/kollavarsham-go/converter/v2"
)

func main() {

	latitude := float64(23.2)
	longitude := float64(75.8)
	system := "SuryaSiddhanta"
	kv := converter.NewKollavarsham(&converter.Settings{
		Latitude:  &latitude,
		Longitude: &longitude,
		System:    &system,
	})

	now := time.Now()
	today := kv.FromGregorianDate(&now)

	fmt.Printf("Today in Malayalam Year: %v %v %v (%v)\n", *today.Year(), *today.MlMasaName(), *today.Date(), *today.MlNaksatraName())
}

Java

package org.kollavarsham.tester;

import java.time.Instant;

import org.kollavarsham.converter.Kollavarsham;
import org.kollavarsham.converter.KollavarshamDate;
import org.kollavarsham.converter.Settings;
import org.kollavarsham.converter.Settings.Builder;

public class App {
    public static void main( final String[] args) {
        final Settings settings = new Builder().latitude(10).longitude(76.2).system("SuryaSiddhanta").build();
        final Kollavarsham kv = new Kollavarsham(settings);
        final KollavarshamDate today = kv.fromGregorianDate(Instant.now());
        System.out.println( today.getYear() + today.getMlMasaName() + today.getDate() + '(' + today.getMlNaksatraName() + ')' );
    }
}

C#/dotnet

using System;

namespace KollavarshamOrg.Tester
{
    class Program
    {
        static void Main(string[] args)
        {
            var settings = new Settings {
                Latitude = 10,
                Longitude = 76.2,
                System = "SuryaSiddhanta"
            };
            var kv = new Kollavarsham(settings);
            var today = kv.FromGregorianDate(DateTime.Now);
            Console.WriteLine($"{today.Year.ToString()} {today.MlMasaName} {today.Date.ToString()} ({today.MlNaksatraName})");
        }
    }
}

Documentation

TypeScript/JavaScript/Node.js

Check out the Kollavarsham class within the API documentation as this is the entry point into the library.

Release History

Check out the history at GitHub Releases

License

Copyright (c) 2014-2023 The Kollavarsham Team. Licensed under the MIT license.

FOSSA Status

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kollavarsham-2.5.4.tar.gz (80.8 kB view details)

Uploaded Source

Built Distribution

kollavarsham-2.5.4-py3-none-any.whl (79.1 kB view details)

Uploaded Python 3

File details

Details for the file kollavarsham-2.5.4.tar.gz.

File metadata

  • Download URL: kollavarsham-2.5.4.tar.gz
  • Upload date:
  • Size: 80.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.3

File hashes

Hashes for kollavarsham-2.5.4.tar.gz
Algorithm Hash digest
SHA256 201ec40bf74c33004ccbe735789c560cb3288abf341bb6566e33465a6bd63beb
MD5 e3cfcb2afa06c70635cf82f02e38a3e2
BLAKE2b-256 3a59c21e6771a89f4f27a514d87f5ee6b7e9bda90024dc776ce2c38181985497

See more details on using hashes here.

File details

Details for the file kollavarsham-2.5.4-py3-none-any.whl.

File metadata

File hashes

Hashes for kollavarsham-2.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ca79910553bf671fad6d95f3f4f2e8ef60b95e0fedc68718588ad37bfbf60d61
MD5 a8226f31ec12c4b029e8f4b47905187f
BLAKE2b-256 44a71f2572f7c5928f898be0490d8dc4a88ca161486ff65e91ada620f7aa3d79

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page