Coder Social home page Coder Social logo

peradnya / balinese-date-js-lib Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 4.0 252 KB

BalineseDate is a open source library to develop Balinese Saka Calendar (Kalender Bali) in Javascript.

License: Apache License 2.0

TypeScript 56.80% JavaScript 36.60% HTML 6.60%
javascript calendar kalender bali saka library open-source typescript nodejs umd

balinese-date-js-lib's Introduction

BalineseDate Javascript Library

pipeline status coverage report

Introduction

BalineseDate is an open source javascript library to build Balinese Saka Calendar in HTML-page or NodeJS.

Note: This library is in Beta Phase, the API may change without notice.

Features

BalineseDate is designed to be immutable. BalineseDate have several features like:

BalineseDate also have several utilities that can be use by developer like:

  • Filter BalineseDate(s) from selected Date (v0.2.0)
  • Filter BalineseDate(s) from selected BalineseDate List (v0.4.0)
  • List of Rahinan given the BalineseDate (v0.4.2)

Import BalineseDate into Your Project

BalineseDate Javascript Library use unpkg as repository to publish UMD Library, and also use npmjs.com as repository to publish NodeJS Library.

To import BalineseDate to your project, please choose one of these following method:

Direct Download

NPM Install

NPM

Documentation

How to Build

Requirement

The recomended requirement to build this project are:

  1. Latest NodeJS (Recomended >= 10.x)
  2. Latest Git Client

Download and Install BalineseDate Depedencies

To install NPM depedencies that nessesary to build this project, you should execute the command below:

[project root]$ npm install

Building BalineseDate Library

To build all type of BalineseDate Libraries (NodeJS library, UMD library, and production-ready UMD library), you should execute the command below:

[project root]$ npm run build

If you only need to build specific type of BalineseDate library, you can execute the commands below:

# Build NodeJS Library
[project root]$ npm run build:nodejs

# Build UMD Library
[project root]$ npm run build:umd

# Build production-ready UMD Library
[project root]$ npm run build:umd-dist

Building Documentation (Typedoc)

Documentation of BalineseDate Library can be built by executing the command below:

[project root]$ npm run doc

You can find the documentation at:

[project root]/doc/index.html

Testing & Checking

Testing and checking of BalineseDate Library can be done by executing the command below:

[project root]$ npm run test

To build test result, you should enter the command below:

[project root]$ npm run report

You could find the test results at:

[project root]/coverage/lcov-report/index.html

Using in Code

ES6/Typescript Approach

BalineseDate support Typescript by implementing declaration file *.d.ts inside the NodeJS library.

Below code is an example of how to use of BalineseDate (NodeJS version) library in Typescript *.ts file:

import { BalineseDate } from "balinese-date-js-lib";

const now = new BalineseDate();

console.log(now.saka); // show the saka
console.log(now.sasih.name); // show the sasih name
console.log(now.wuku.name); // show the wuku name

CommonJS (NodeJS) Approach

Below code is an example of how to use of BalineseDate (UMD or NodeJS version) library using CommonJS (NodeJS) approach:

const BD = require('balinese-date-js-lib');

const now = new BD.BalineseDate();

console.log(now.saka); // show the saka
console.log(now.sasih.name); // show the sasih name
console.log(now.wuku.name); // show the wuku name

RequireJS (AMD) Approach

Below code is an example of how to use of BalineseDate (UMD version) library via RequireJS (AMD):

<script src="require.js"></script>
<script src="balinese-date-js-lib.min.js"></script>
<script>
    requirejs(["BalineseDate"], function(BD) {
      var now = new BD.BalineseDate();

      document.getElementById("saka").innerHTML = now.saka;
      document.getElementById("sasih").innerHTML = now.sasih.name;
      document.getElementById("wuku").innerHTML = now.wuku.name;
    });
</script>

The example(s) of how to use UMD version of BalineseDate library via require.js in the HTML-page are available at:

[project root]/example/webpage/today-requirejs.html

HTML-page "Direct" Approach

Below code is an example of how to use of BalineseDate (UMD version) library directly in the HTML-page:

<script src="balinese-date-js-lib.min.js"></script>
<script>
    var BD = window.BalineseDate;
    var now = new BD.BalineseDate();

    document.getElementById("saka").innerHTML = now.saka;
    document.getElementById("sasih").innerHTML = now.sasih.name;
    document.getElementById("wuku").innerHTML = now.wuku.name;
</script>

The example(s) of how to use UMD version of BalineseDate library directly in the HTML-page are available at:

[project root]/example/webpage/today.html

References

  • Ardhana, I.B.S. (2005). "Pokok-Pokok Wariga". Surabaya : Paramita.
  • babadbali.com (Yayasan Bali Galang) for wewaran and paringkelan algorithm.
  • Pendit, Nyoman. (2001). "Nyepi: kebangkitan, toleransi, dan kerukunan". Jakarta : Gramedia. Retrieved at google book.
  • kalenderbali.org and kalenderbali.info for validation and building sample test-cases.

balinese-date-js-lib's People

Contributors

peradnya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.