-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
72 lines (55 loc) · 2.74 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
var prompt = require('sync-prompt').prompt;
var dob = new Date(prompt('Please enter your date of birth in the format dd/mm/yyyy: '))
var date = new Date()
var yearDiff = date.getFullYear()-dob.getFullYear()-1
yearDiff = parseInt(yearDiff)
//console.log(yearDiff)
if(dob.getMonth() < date.getMonth()){
yearDiff = yearDiff+1
console.log('You are '+ yearDiff + " years old")
}else if(dob.getMonth() > date.getMonth()){
yearDiff = yearDiff
console.log('You are '+ yearDiff + " years old")
}else if(dob.getDate() >= date.getDate()){
yearDiff = yearDiff + 1
console.log('Happy Birthday!')
console.log('You are '+ yearDiff + " years old")
}else{
console.log('You are '+ yearDiff + " years old")
}
//Capricorn
if(dob.getMonth() === 0 && dob.getDate() <= 19){console.log('You are a Capricorn')}
if(dob.getMonth() === 11 && dob.getDate() >= 22){console.log('You are a Capricorn')}
//Aquarius
if(dob.getMonth() === 0 && dob.getDate() >= 20){console.log('You are a Aquarius')}
if(dob.getMonth() === 1 && dob.getDate() <= 18){console.log('You are a Aquarius')}
//Pisces
if(dob.getMonth() === 1 && dob.getDate() >= 19){console.log('You are a Pisces')}
if(dob.getMonth() === 2 && dob.getDate() <= 20){console.log('You are a Pisces')}
//Aries
if(dob.getMonth() === 2 && dob.getDate() >= 21){console.log('You are a Aries')}
if(dob.getMonth() === 3 && dob.getDate() <= 19){console.log('You are a Aries')}
//Taurus
if(dob.getMonth() === 3 && dob.getDate() >= 20){console.log('You are a Taurus')}
if(dob.getMonth() === 4 && dob.getDate() <= 20){console.log('You are a Taurus')}
//Gemini
if(dob.getMonth() === 4 && dob.getDate() >= 21){console.log('You are a Gemini')}
if(dob.getMonth() === 5 && dob.getDate() <= 20){console.log('You are a Gemini')}
//Cancer
if(dob.getMonth() === 5 && dob.getDate() >= 21){console.log('You are a Cancer')}
if(dob.getMonth() === 6 && dob.getDate() <= 22){console.log('You are a Cancer')}
//Leo
if(dob.getMonth() === 6 && dob.getDate() >= 23){console.log('You are a Leo')}
if(dob.getMonth() === 7 && dob.getDate() <= 22){console.log('You are a Leo')}
//Virgo
if(dob.getMonth() === 7 && dob.getDate() >= 23){console.log('You are a Virgo')}
if(dob.getMonth() === 8 && dob.getDate() <= 22){console.log('You are a Virgo')}
//Libra
if(dob.getMonth() === 8 && dob.getDate() >= 23){console.log('You are a Libra')}
if(dob.getMonth() === 9 && dob.getDate() <= 22){console.log('You are a Libra')}
//Scorpio
if(dob.getMonth() === 9 && dob.getDate() >= 23){console.log('You are a Scorpio')}
if(dob.getMonth() === 10 && dob.getDate() <= 21){console.log('You are a Scorpio')}
//Sagittarius
if(dob.getMonth() === 10 && dob.getDate() >= 22){console.log('You are a Sagittarius')}
if(dob.getMonth() === 11 && dob.getDate() <= 21){console.log('You are a Sagittarius')}