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/
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>npm i thingyanyarn add thingyanpnpm i thingyanimport { type ThinGyan, thingyan } from "thingyan";
const my: number = 1386; // Myanmar Year
const tg: ThinGyan = thingyan(my);
// Rest of codeBefore that read first Using JSR with Node.js.
npx jsr add @ptm/thingyanyarn dlx jsr add @ptm/thingyanpnpm dlx jsr add @ptm/thingyanimport * 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 codeAPI docs on jsr registry.
update deno to latest version to active add
deno add @ptm/thingyanThat 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.tsbunx jsr add @ptm/thingyanThat 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.tsyarn add thingyanworker.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',
},
});
},
};The algorithm and calculations of this package are base on Modern Myanmar Calendrical Calculations by Yan Naing Aye.