Skip to content

Latest commit

 

History

History
48 lines (28 loc) · 1.58 KB

README.md

File metadata and controls

48 lines (28 loc) · 1.58 KB

IONIC 3 supportable provider to get date according to the Coptic Christianity

IONIC 3.0 with angular + typescript

mobile-coptic

Adding to your project

  1. Run ionic generate provider coptic-date in your ionic project. It will generate provider file under src folder
  2. Copy the code from provider which is available in the github (https://github.com/nbadiganti/coptic-date-mobile/blob/master/src/providers/coptic-date/coptic-date.ts)

Adding provider to your ionic project

  1. Run import { CopticDateProvider } from '../providers/coptic-date/coptic-date'; to your app.module.ts file
  2. Add CopticDateProvider to your providers array in app.module.ts

Get coptic date in your component

constructor(public navCtrl: NavController, public copticProv: CopticDateProvider) {
  // Return today's date and time
  var currentTime = new Date();

  // returns the month (from 0 to 11)
  var month = currentTime.getMonth();

  // returns the day of the month (from 1 to 31)
  var day = currentTime.getDate();

  // returns the year (four digits)
  var year = currentTime.getFullYear();

  console.log(month, day + " " + year);

  this.copticDate = this.copticProv.getCopticDateString(year, month, day);
  console.log(this.copticDate);
}

Reference links to create this provider - https://github.com/dbishai/orthodox-presenter/blob/master/js/lib/CopticCalendar.js

License

This project is licensed under the MIT License