-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask2.js
More file actions
49 lines (47 loc) · 955 Bytes
/
task2.js
File metadata and controls
49 lines (47 loc) · 955 Bytes
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
function checkDate (){
var Date1 = new Date (process.argv[4], monthConvert(process.argv[3]), process.argv[2]);
var Date2 = new Date (process.argv[4], 11, 31);
var Days = Math.floor((Date2.getTime() - Date1.getTime())/(1000*60*60*24));
return Days;
}
function monthConvert (monthName){
switch(monthName) {
case 'января':
return 0;
break;
case 'февраля':
return 1;
break;
case 'марта':
return 2;
break;
case 'апреля':
return 3;
break;
case 'мая':
return 4;
break;
case 'июня':
return 5;
break;
case 'июля':
return 6;
break;
case 'августа':
return 7;
break;
case 'сентября':
return 8;
break;
case 'октября':
return 9;
break;
case 'ноября':
return 10;
break;
case 'декабря':
return 11;
break;
}
}
console.log (checkDate());