-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8e79d8
commit 5eaea8a
Showing
7 changed files
with
225 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
[ | ||
{ | ||
"no": "#1", | ||
"date": "2020-04-25", | ||
"sehar": "3:55 AM", | ||
"iftar": "6:40 PM" | ||
}, | ||
{ | ||
"no": "#2", | ||
"date": "2020-04-26", | ||
"sehar": "3:54 AM", | ||
"iftar": "6:40 PM" | ||
}, | ||
{ | ||
"no": "#3", | ||
"date": "2020-04-27", | ||
"sehar": "3:52 AM", | ||
"iftar": "6:41 PM" | ||
}, | ||
{ | ||
"no": "#4", | ||
"date": "2020-04-28", | ||
"sehar": "3:51 AM", | ||
"iftar": "6:42 PM" | ||
}, | ||
{ | ||
"no": "#5", | ||
"date": "2020-04-29", | ||
"sehar": "3:50 AM", | ||
"iftar": "6:43 PM" | ||
}, | ||
{ | ||
"no": "#6", | ||
"date": "2020-04-30", | ||
"sehar": "3:49 AM", | ||
"iftar": "6:43 PM" | ||
}, | ||
{ | ||
"no": "#7", | ||
"date": "2020-05-01", | ||
"sehar": "3:47 AM", | ||
"iftar": "6:44 PM" | ||
}, | ||
{ | ||
"no": "#8", | ||
"date": "2020-05-02", | ||
"sehar": "3:46 AM", | ||
"iftar": "6:45 PM" | ||
}, | ||
{ | ||
"no": "#9", | ||
"date": "2020-05-03", | ||
"sehar": "3:45 AM", | ||
"iftar": "6:45 PM" | ||
}, | ||
{ | ||
"no": "#10", | ||
"date": "2020-05-04", | ||
"sehar": "3:44 AM", | ||
"iftar": "6:46 PM" | ||
}, | ||
{ | ||
"no": "#11", | ||
"date": "2020-05-05", | ||
"sehar": "3:43 AM", | ||
"iftar": "6:47 PM" | ||
}, | ||
{ | ||
"no": "#12", | ||
"date": "2020-05-06", | ||
"sehar": "3:41 AM", | ||
"iftar": "6:47 PM" | ||
}, | ||
{ | ||
"no": "#13", | ||
"date": "2020-05-07", | ||
"sehar": "3:40 AM", | ||
"iftar": "6:48 PM" | ||
}, | ||
{ | ||
"no": "#14", | ||
"date": "2020-05-08", | ||
"sehar": "3:39 AM", | ||
"iftar": "6:49 PM" | ||
}, | ||
{ | ||
"no": "#15", | ||
"date": "2020-05-09", | ||
"sehar": "3:38 AM", | ||
"iftar": "6:50 PM" | ||
}, | ||
{ | ||
"no": "#16", | ||
"date": "2020-05-10", | ||
"sehar": "3:37 AM", | ||
"iftar": "6:50 PM" | ||
}, | ||
{ | ||
"no": "#17", | ||
"date": "2020-05-11", | ||
"sehar": "3:36 AM", | ||
"iftar": "6:51 PM" | ||
}, | ||
{ | ||
"no": "#18", | ||
"date": "2020-05-12", | ||
"sehar": "3:35 AM", | ||
"iftar": "6:52 PM" | ||
}, | ||
{ | ||
"no": "#19", | ||
"date": "2020-05-13", | ||
"sehar": "3:34 AM", | ||
"iftar": "6:52 PM" | ||
}, | ||
{ | ||
"no": "#20", | ||
"date": "2020-05-14", | ||
"sehar": "3:33 AM", | ||
"iftar": "6:53 PM" | ||
}, | ||
{ | ||
"no": "#21", | ||
"date": "2020-05-15", | ||
"sehar": "3:32 AM", | ||
"iftar": "6:54 PM" | ||
}, | ||
{ | ||
"no": "#22", | ||
"date": "2020-05-16", | ||
"sehar": "3:31 AM", | ||
"iftar": "6:54 PM" | ||
}, | ||
{ | ||
"no": "#23", | ||
"date": "2020-05-17", | ||
"sehar": "3:30 AM", | ||
"iftar": "6:55 PM" | ||
}, | ||
{ | ||
"no": "#24", | ||
"date": "2020-05-18", | ||
"sehar": "3:29 AM", | ||
"iftar": "6:56 PM" | ||
}, | ||
{ | ||
"no": "#25", | ||
"date": "2020-05-19", | ||
"sehar": "3:29 AM", | ||
"iftar": "6:56 PM" | ||
}, | ||
{ | ||
"no": "#26", | ||
"date": "2020-05-20", | ||
"sehar": "3:28 AM", | ||
"iftar": "6:57 PM" | ||
}, | ||
{ | ||
"no": "#27", | ||
"date": "2020-05-21", | ||
"sehar": "3:27 AM", | ||
"iftar": "6:58 PM" | ||
}, | ||
{ | ||
"no": "#28", | ||
"date": "2020-05-22", | ||
"sehar": "3:26 AM", | ||
"iftar": "6:58 PM" | ||
}, | ||
{ | ||
"no": "#29", | ||
"date": "2020-05-23", | ||
"sehar": "3:25 AM", | ||
"iftar": "6:59 PM" | ||
}, | ||
{ | ||
"no": "#30", | ||
"date": "2020-05-24", | ||
"sehar": "3:25 AM", | ||
"iftar": "7:00 PM" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,39 @@ | ||
#!/usr/bin/env node | ||
|
||
const ora = require('ora'); | ||
const spinner = ora({text: ''}); | ||
// const {green, yellow, hex} = require('chalk'); | ||
const chalk = require('chalk'); | ||
const sym = require('log-symbols'); | ||
const cli = require('./utils/cli.js'); | ||
const init = require('./utils/init.js'); | ||
const to = require('await-to-js').default; | ||
const theEnd = require('./utils/theEnd.js'); | ||
const handleError = require('cli-handle-error'); | ||
const data = require('./data/lahore.json'); | ||
const dateDiff = require('./utils/dateDiff'); | ||
const Table = require('cli-table3'); | ||
const green = string => chalk.hex(`#81EF96`)(string); | ||
|
||
// CLI. | ||
const [input] = cli.input; | ||
const option = cli.flags.option; | ||
|
||
(async () => { | ||
init(); | ||
const firstRoza = '2020-04-25'; | ||
const today = new Date().toISOString().substring(0, 10); | ||
const rozaNumber = dateDiff(firstRoza, '2020-06-10'); | ||
if (rozaNumber > 30) { | ||
console.log( | ||
`${sym.success} Eid Mubarak.\nRamadan is already over. Hope you had a fun time on Eid.\n` | ||
); | ||
} else { | ||
const roza = rozaNumber > 1 ? data[rozaNumber] : data[0]; | ||
|
||
const table = new Table({ | ||
head: [green('Roza'), green('Sehar'), green('Iftar')] | ||
}); | ||
|
||
table.push([roza.no, roza.sehar, roza.iftar]); | ||
console.log(table.toString()); | ||
} | ||
theEnd(); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = (first, second) => { | ||
// Take the difference between the dates and divide by milliseconds per day. | ||
// Round to nearest whole number to deal with DST. | ||
return Math.round( | ||
(new Date(second) - new Date(first)) / (1000 * 60 * 60 * 24) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
const sym = require('log-symbols'); | ||
const chalk = require('chalk'); | ||
const {dim} = require('chalk'); | ||
|
||
module.exports = async () => { | ||
console.log(`${sym.success} All done.\n`); | ||
console.log( | ||
`\n${sym.success} ${dim( | ||
`Star the repo for updates → https://git.io/ramadan-cli` | ||
)}\n${sym.info} ${dim( | ||
`Follow for more CLIs → https://twitter.com/MrAhmadAwais\n\n` | ||
)}` | ||
); | ||
}; |