1 | # BalineseDate Javascript Library
|
2 |
|
3 | [![pipeline status](https://gitlab.com/peradnya/balinese-date-js-lib/badges/master/pipeline.svg)](https://gitlab.com/peradnya/balinese-date-js-lib/commits/master)
|
4 | [![coverage report](https://gitlab.com/peradnya/balinese-date-js-lib/badges/master/coverage.svg)](https://gitlab.com/peradnya/balinese-date-js-lib/commits/master)
|
5 |
|
6 | ## Introduction
|
7 |
|
8 | BalineseDate is an open source javascript library to build Balinese Saka Calendar in HTML-page or NodeJS.
|
9 |
|
10 | > **Note**: This library is in **Beta Phase**, the API may change without notice.
|
11 |
|
12 | ## Features
|
13 |
|
14 | BalineseDate is designed to be __immutable__. BalineseDate have several features like:
|
15 |
|
16 | * [Pawukon](http://www.babadbali.com/pewarigaan/kalender-pawukon.htm)
|
17 | * [Pawewaran](http://www.babadbali.com/pewarigaan/pawewaran.htm)
|
18 | * [EkaWara](http://www.babadbali.com/pewarigaan/ekawara.htm)
|
19 | * [DwiWara](http://www.babadbali.com/pewarigaan/dwiwara.htm)
|
20 | * [TriWara](http://www.babadbali.com/pewarigaan/triwara.htm)
|
21 | * [CaturWara](http://www.babadbali.com/pewarigaan/caturwara.htm)
|
22 | * [PancaWara](http://www.babadbali.com/pewarigaan/pancawara.htm)
|
23 | * [SadWara](http://www.babadbali.com/pewarigaan/sadwara.htm)
|
24 | * [SaptaWara](http://www.babadbali.com/pewarigaan/saptawara.htm)
|
25 | * [AstaWara](http://www.babadbali.com/pewarigaan/astawara.htm)
|
26 | * [SangaWara](http://www.babadbali.com/pewarigaan/sangawara.htm)
|
27 | * [DasaWara](http://www.babadbali.com/pewarigaan/dasawara.htm)
|
28 | * [Paringkelan](http://www.babadbali.com/pewarigaan/paringkelan.htm)
|
29 | * [Jejepan](http://www.babadbali.com/pewarigaan/jejepan.htm)
|
30 | * [Ingkel](http://www.babadbali.com/pewarigaan/ingkel.htm)
|
31 | * [Pawatekan Madya & Alit](http://www.babadbali.com/pewarigaan/watek.htm)
|
32 | * [Lintang](http://www.babadbali.com/pewarigaan/lintang.htm)
|
33 | * [PancaSuda](http://www.babadbali.com/pewarigaan/pancasuda.htm)
|
34 | * [Pararasan](http://www.babadbali.com/pewarigaan/paarasan.htm)
|
35 | * [Rakam](http://www.babadbali.com/pewarigaan/rakam.htm)
|
36 | * Eka Jala Rsi __(v0.3.0)__
|
37 | * Pratithi Samut Pada __(v0.3.0)__
|
38 | * Dewasa __(v0.5.0)__
|
39 | * Sasih
|
40 | * Pawukon/Penanggal and Nguna Ratri.
|
41 | * Pengalantaka Eka Sungsang Pon (before 2000) & Paing (2000 and after)
|
42 | * Malamasa (< 1993), Sasih Kesinambungan (1993 - 2002), Nampih Sasih (>= 2003)
|
43 | * [Saka Year](http://www.babadbali.com/pewarigaan/kalender-saka.htm)
|
44 | * Rahinan __(v0.4.2)__
|
45 |
|
46 | BalineseDate also have several utilities that can be use by developer like:
|
47 |
|
48 | * Filter BalineseDate(s) from selected Date __(v0.2.0)__
|
49 | * Filter BalineseDate(s) from selected BalineseDate List __(v0.4.0)__
|
50 | * List of Rahinan given the BalineseDate __(v0.4.2)__
|
51 |
|
52 | ## Import BalineseDate into Your Project
|
53 |
|
54 | BalineseDate Javascript Library use [**unpkg**](https://unpkg.com/balinese-date-js-lib/) as repository to publish UMD Library, and also use [**npmjs.com**](https://www.npmjs.com/package/balinese-date-js-lib) as repository to publish NodeJS Library.
|
55 |
|
56 | To import BalineseDate to your project, please choose one of these following method:
|
57 |
|
58 | ### Direct Download
|
59 |
|
60 | * [balinese-date-js-lib.js (debug)](https://unpkg.com/balinese-date-js-lib/umd/balinese-date-js-lib.js)
|
61 | * [balinese-date-js-lib.js.map](https://unpkg.com/balinese-date-js-lib/umd/balinese-date-js-lib.js.map)
|
62 | * [balinese-date-js-lib.min.js (production)](https://unpkg.com/balinese-date-js-lib/umd/balinese-date-js-lib.min.js)
|
63 | * [balinese-date-js-lib.min.js.map](https://unpkg.com/balinese-date-js-lib/umd/balinese-date-js-lib.min.js.map)
|
64 |
|
65 | ### NPM Install
|
66 |
|
67 | [![NPM](https://nodei.co/npm/balinese-date-js-lib.png)](https://nodei.co/npm/balinese-date-js-lib/)
|
68 |
|
69 | ## Documentation
|
70 |
|
71 | * [Latest (master)](https://peradnya.gitlab.io/balinese-date-js-lib/index.html)
|
72 |
|
73 | ## How to Build
|
74 |
|
75 | ### Requirement
|
76 |
|
77 | The recomended requirement to build this project are:
|
78 |
|
79 | 1. Latest NodeJS (Recomended >= 10.x)
|
80 | 2. Latest Git Client
|
81 |
|
82 | ### Download and Install BalineseDate Depedencies
|
83 |
|
84 | To install NPM depedencies that nessesary to build this project, you should execute the command below:
|
85 |
|
86 | ```sh
|
87 | [project root]$ npm install
|
88 | ```
|
89 |
|
90 | ### Building BalineseDate Library
|
91 |
|
92 | To build all type of BalineseDate Libraries (NodeJS library, UMD library, and production-ready UMD library), you should execute the command below:
|
93 |
|
94 | ```sh
|
95 | [project root]$ npm run build
|
96 | ```
|
97 |
|
98 | If you only need to build specific type of BalineseDate library, you can execute the commands below:
|
99 |
|
100 | ```sh
|
101 | # Build NodeJS Library
|
102 | [project root]$ npm run build:nodejs
|
103 |
|
104 | # Build UMD Library
|
105 | [project root]$ npm run build:umd
|
106 |
|
107 | # Build production-ready UMD Library
|
108 | [project root]$ npm run build:umd-dist
|
109 | ```
|
110 |
|
111 | ### Building Documentation (Typedoc)
|
112 |
|
113 | Documentation of BalineseDate Library can be built by executing the command below:
|
114 |
|
115 | ```sh
|
116 | [project root]$ npm run doc
|
117 | ```
|
118 |
|
119 | You can find the documentation at:
|
120 |
|
121 | ```sh
|
122 | [project root]/doc/index.html
|
123 | ```
|
124 |
|
125 | ### Testing & Checking
|
126 |
|
127 | Testing and checking of BalineseDate Library can be done by executing the command below:
|
128 |
|
129 | ```sh
|
130 | [project root]$ npm run test
|
131 | ```
|
132 |
|
133 | To build test result, you should enter the command below:
|
134 |
|
135 | ```sh
|
136 | [project root]$ npm run report
|
137 | ```
|
138 |
|
139 | You could find the test results at:
|
140 |
|
141 | ```sh
|
142 | [project root]/coverage/lcov-report/index.html
|
143 | ```
|
144 |
|
145 | ## Using in Code
|
146 |
|
147 | ### ES6/Typescript Approach
|
148 |
|
149 | BalineseDate support Typescript by implementing declaration file ```*.d.ts``` inside the **NodeJS** library.
|
150 |
|
151 | Below code is an example of how to use of BalineseDate (**NodeJS** version) library in Typescript ```*.ts``` file:
|
152 |
|
153 | ```js
|
154 | import { BalineseDate } from "balinese-date-js-lib";
|
155 |
|
156 | const now = new BalineseDate();
|
157 |
|
158 | console.log(now.saka); // show the saka
|
159 | console.log(now.sasih.name); // show the sasih name
|
160 | console.log(now.wuku.name); // show the wuku name
|
161 | ```
|
162 |
|
163 | ### CommonJS (NodeJS) Approach
|
164 |
|
165 | Below code is an example of how to use of BalineseDate (**UMD** or **NodeJS** version) library using CommonJS (NodeJS) approach:
|
166 |
|
167 | ```js
|
168 | const BD = require('balinese-date-js-lib');
|
169 |
|
170 | const now = new BD.BalineseDate();
|
171 |
|
172 | console.log(now.saka); // show the saka
|
173 | console.log(now.sasih.name); // show the sasih name
|
174 | console.log(now.wuku.name); // show the wuku name
|
175 | ```
|
176 |
|
177 | ### RequireJS (AMD) Approach
|
178 |
|
179 | Below code is an example of how to use of BalineseDate (**UMD** version) library via [**RequireJS**](https://requirejs.org) (AMD):
|
180 |
|
181 | ```html
|
182 | <script src="require.js"></script>
|
183 | <script src="balinese-date-js-lib.min.js"></script>
|
184 | <script>
|
185 | requirejs(["BalineseDate"], function(BD) {
|
186 | var now = new BD.BalineseDate();
|
187 |
|
188 | document.getElementById("saka").innerHTML = now.saka;
|
189 | document.getElementById("sasih").innerHTML = now.sasih.name;
|
190 | document.getElementById("wuku").innerHTML = now.wuku.name;
|
191 | });
|
192 | </script>
|
193 | ```
|
194 |
|
195 | The example(s) of how to use __UMD version__ of BalineseDate library via **require.js** in the HTML-page are available at:
|
196 |
|
197 | ```sh
|
198 | [project root]/example/webpage/today-requirejs.html
|
199 | ```
|
200 |
|
201 | ### HTML-page "Direct" Approach
|
202 |
|
203 | Below code is an example of how to use of BalineseDate (**UMD** version) library **directly** in the HTML-page:
|
204 |
|
205 | ```html
|
206 | <script src="balinese-date-js-lib.min.js"></script>
|
207 | <script>
|
208 | var BD = window.BalineseDate;
|
209 | var now = new BD.BalineseDate();
|
210 |
|
211 | document.getElementById("saka").innerHTML = now.saka;
|
212 | document.getElementById("sasih").innerHTML = now.sasih.name;
|
213 | document.getElementById("wuku").innerHTML = now.wuku.name;
|
214 | </script>
|
215 | ```
|
216 |
|
217 | The example(s) of how to use __UMD version__ of BalineseDate library **directly** in the HTML-page are available at:
|
218 |
|
219 | ```sh
|
220 | [project root]/example/webpage/today.html
|
221 | ```
|
222 |
|
223 | ## References
|
224 |
|
225 | * Ardhana, I.B.S. (2005). *"Pokok-Pokok Wariga"*. Surabaya : Paramita.
|
226 | * babadbali.com (Yayasan Bali Galang) for [wewaran](http://www.babadbali.com/pewarigaan/perhitungan.htm) and [paringkelan](http://www.babadbali.com/pewarigaan/paringkelan.htm) algorithm.
|
227 | * Pendit, Nyoman. (2001). *"Nyepi: kebangkitan, toleransi, dan kerukunan"*. Jakarta : Gramedia. Retrieved at [google book](https://books.google.co.id/books?id=4ND9KPn2o8AC).
|
228 | * kalenderbali.org and kalenderbali.info for validation and building sample test-cases. |
\ | No newline at end of file |