Skip to content
/ ken.js Public

Ethiopian Date converter that works for the browser and node.js

Notifications You must be signed in to change notification settings

miqe/ken.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Ethiopian Date converter that works for the browser and node.js

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published