Skip to content

Commit e52ad1b

Browse files
committed
update SkillfactoryCoding#10 rewrite randomDate
1 parent 78e7020 commit e52ad1b

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

bjs/10_function_object/personGenerator.js

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,22 @@ const personGenerator = {
7777
}
7878
}`,
7979

80+
months:
81+
{
82+
1: "января",
83+
2: "февраля",
84+
3: "марта",
85+
4: "апреля",
86+
5: "мая",
87+
6: "июня",
88+
7: "июля",
89+
8: "августа",
90+
9: "сентября",
91+
10: "октября",
92+
11: "ноября",
93+
12: "декабря"
94+
},
95+
8096
GENDER_MALE: 'Мужчина',
8197
GENDER_FEMALE: 'Женщина',
8298

@@ -176,13 +192,13 @@ const personGenerator = {
176192

177193
randomGender: function() {
178194

179-
return this.randomIntNumber() === 1 ? this.GENDER_MALE : this.GENDER_FEMALE;
195+
return this.randomIntNumber() ? this.GENDER_MALE : this.GENDER_FEMALE;
180196

181197
},
182198

183199
randomDate: function() {
184200

185-
const year = this.randomIntNumber(110, 70) + 1900;
201+
const year = this.randomIntNumber(104, 70) + 1900;
186202
const month = this.randomIntNumber(12, 1);
187203

188204
const isEven = month % 2 === 0;
@@ -205,7 +221,11 @@ const personGenerator = {
205221

206222
const day = this.randomIntNumber(maxDay, 1);
207223

208-
return `${day}.${month}.${year}`;
224+
225+
226+
let textMonth = this.months[month]
227+
228+
return `${day} ${textMonth} ${year} г.`;
209229
},
210230

211231

0 commit comments

Comments
 (0)