0.0.6 • Published 6 years ago

ken.js v0.0.6

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

Ken.js (ቀን.ጄኤስ)

A date converter which uses pattern based algorithm to convert ethiopian date to gregorian and vice versa

Ethiopian Date converter

it works for both the browser and node.js

Installation :

$ npm install ken.js --save

or

$ bower install ken.js --save

usage:

To convert Gregorian Date to Ethiopian:
  // using date object
  var converter = new ken(new Date());
  
  // or using plain string
  var converter = new ken("2017-04-15");
   
  converter.toEC().toString(); //output: "2009-08-07"
To convert Ethiopian Date to Gregorian:
  
  var converter = new ken("2009-08-07");
  
   
  converter.toGC().toString(); //output: "2009-08-07"
  //to get a javascript date object
  converter.toGC().getDateInstance(); //output: converter.toGC().getDateInstance()
to convert to Ethiopian directly from date object:
//add toEC to Date object
Date.prototype.toEC=function(){
    return ken(this).toEC();
}

//then simply do
var today = new Date();
today.toEC().toString(); 

Testing:

$ npm test  > test-result.log 2>&1
i.e because the test usecase uses iteration, please change the output of the test to a file.
0.0.6

6 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

8 years ago