thingyan
v0.1.1
Published
Calculates the dates and times for the Mahar Thingyan(New Year) festival based on the given Myanmar year
Downloads
5
Maintainers
Readme
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.
- AkyaDayTime: string;
- AkyatDay: string;
- AkyatDay2: string;
- AkyoDay: string;
- AtatDayTime: string;
- NewYearDay: string;
- YearFrom: number;
- 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/[email protected]";
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/[email protected]/"
}
}
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
- http://localhost:8000/
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
- http://localhost:3000/
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.