phothinmg / thingyan

Home Page:https://phothinmg.github.io/thingyan/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

thingyan

codecov JSR Score


About

The Myanmar new year festival (the water festival) is called the Thingyan.

This package focus on calculate information of thingyan festival days and times , that can be use in morden javascript runtimes.The function named thingyan , that generate the following from a Myanmar(Burmese) year.

  1. AkyaDayTime: string;
  2. AkyatDay: string;
  3. AkyatDay2: string;
  4. AkyoDay: string;
  5. AtatDayTime: string;
  6. NewYearDay: string;
  7. YearFrom: number;
  8. YearTo: number;

Live Thingyan Calculator : https://phothinmg.github.io/thingyan/

API Docs : https://phothinmg.github.io/thingyan/api/


Install and Usage

Browser

Import function thingyan from:

esm.run

<script type="module">
  import { thingyan } from "https://esm.run/thingyan";
  const my = 1386; // Myanmar Year
  console.log(thingyan(my));
</script>

esm.sh

<script type="module">
  import { thingyan } from "https://esm.sh/thingyan@0.1.0";
  const my = 1386; // Myanmar Year
  console.log(thingyan(my));
</script>

Node ( npm registry )

npm i thingyan
yarn  add thingyan
pnpm i thingyan
import { type ThinGyan,  thingyan } from "thingyan";
const my: number = 1386; // Myanmar Year
const tg: ThinGyan = thingyan(my);

// Rest of code

Node ( jsr registry )

Before that read first Using JSR with Node.js.

npx jsr add @ptm/thingyan
yarn dlx jsr add @ptm/thingyan
pnpm dlx jsr add @ptm/thingyan
import * as mod from "@ptm/thingyan";
//OR
import { thingyan } from "@ptm/thingyan";
import { type ThinGyan } from "@ptm/thingyan";

const my: number = 1386; // Myanmar Year
const tg: ThinGyan = thingyan(my);

// Rest of code

API docs on jsr registry.

Deno ( jsr registry)

update deno to latest version to active add

deno add @ptm/thingyan

That will automatically be add @ptm/thingyan to deno.json.

{
  "imports": {
    "@ptm/thingyan": "jsr:@ptm/thingyan@^0.1.0",
    "std/": "https://deno.land/std@0.224.0/"
  }
}

index.ts

import { type ThinGyan, thingyan } from "@ptm/thingyan";
const my = 1386; // Myanmar Year
const tg: ThinGyan = thingyan(my);
Deno.serve((_req: Request) => {
  const response = JSON.stringify(tg);

  return new Response(response, {
    status: 200,
    headers: new Headers({ "Content-Type": "application/json" }),
  });
});
deno run --allow-read --allow-net index.ts

Bun ( jsr registry)

bunx jsr add @ptm/thingyan

That will be add install scopes for JSR to bunfig.toml.

[install.scopes]
"@jsr" = "https://npm.jsr.io"

That will automatically be create package.json and add @ptm/thingyan.

{ "dependencies": { "@ptm/thingyan": "npm:@jsr/ptm__thingyan" } }

http.ts

import { type ThinGyan, thingyan } from "@ptm/thingyan";
const my = 1386; // Myanmar Year
const tg: ThinGyan = thingyan(my);

Bun.serve({
  port: 3000,
  fetch() {
    return new Response(JSON.stringify(tg, null, 2), {
      headers: {
        "Content-Type": "application/json",
      },
    });
  },
});
 bun --hot run http.ts

Cloudflare Workers ( npm registry )

yarn add thingyan

worker.ts

import { type ThinGyan, thingyan } from 'thingyan';
const my: number = 1386; // Myanmar Year
const tg: ThinGyan = thingyan(my);

export interface Env{

}

export default {
	async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
		return new Response(JSON.stringify(tg, null, 2), {
			headers: {
				'Content-Type': 'application/json',
			},
		});
	},
};

Acknowledgement

The algorithm and calculations of this package are base on Modern Myanmar Calendrical Calculations by Yan Naing Aye.


About

https://phothinmg.github.io/thingyan/

License:Other


Languages

Language:HTML 57.9%Language:TypeScript 24.0%Language:JavaScript 11.2%Language:CSS 6.9%