Skip to content

Commit aafcf3f

Browse files
committed
finished translating tasks
1 parent 4fa4ab7 commit aafcf3f

File tree

6 files changed

+61
-61
lines changed

6 files changed

+61
-61
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
To get the number of milliseconds till tomorrow, we can from "tomorrow 00:00:00" substract the current date.
1+
Pentru a obține numărul de milisecunde până mâine, putem scădea din "mâine 00:00:00" data curentă.
22

3-
First, we generate that "tomorrow", and then do it:
3+
Mai întâi, generăm acel "mâine", și apoi facem acest lucru:
44

55
```js run
66
function getSecondsToTomorrow() {
77
let now = new Date();
88

9-
// tomorrow date
9+
// data de mâine
1010
let tomorrow = new Date(now.getFullYear(), now.getMonth(), *!*now.getDate()+1*/!*);
1111

12-
let diff = tomorrow - now; // difference in ms
13-
return Math.round(diff / 1000); // convert to seconds
12+
let diff = tomorrow - now; // diferența în ms
13+
return Math.round(diff / 1000); // convertește în secunde
1414
}
1515
```
1616

17-
Alternative solution:
17+
Soluție alternativă:
1818

1919
```js run
2020
function getSecondsToTomorrow() {
@@ -29,4 +29,4 @@ function getSecondsToTomorrow() {
2929
}
3030
```
3131

32-
Please note that many countries have Daylight Savings Time (DST), so there may be days with 23 or 25 hours. We may want to treat such days separately.
32+
Vă rugăm să rețineți că multe țări au ora de vară (DST), astfel încât pot exista zile cu 23 sau 25 de ore. Este posibil să dorim să tratăm aceste zile separat.

Diff for: 1-js/05-data-types/11-date/7-get-seconds-to-tomorrow/task.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ importance: 5
22

33
---
44

5-
# How many seconds till tomorrow?
5+
# Câte secunde până mâine?
66

7-
Create a function `getSecondsToTomorrow()` that returns the number of seconds till tomorrow.
7+
Creați o funcție `getSecondsToTomorrow()` care returnează numărul de secunde până mâine.
88

9-
For instance, if now is `23:00`, then:
9+
De exemplu, dacă acum este `23:00`, atunci:
1010

1111
```js
1212
getSecondsToTomorrow() == 3600
1313
```
1414

15-
P.S. The function should work at any day, the "today" is not hardcoded.
15+
P.S. Funcția ar trebui să funcționeze în orice zi, "astăzi" nu este hardcoded.
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11

22
function formatDate(date) {
3-
let diff = new Date() - date; // the difference in milliseconds
3+
let diff = new Date() - date; // diferența în milisecunde
44

5-
if (diff < 1000) { // less than 1 second
6-
return 'right now';
5+
if (diff < 1000) { // mai puțin de 1 secundă
6+
return 'chiar acum';
77
}
88

9-
let sec = Math.floor(diff / 1000); // convert diff to seconds
9+
let sec = Math.floor(diff / 1000); // convertește diff în secunde
1010

1111
if (sec < 60) {
12-
return sec + ' sec. ago';
12+
return sec + ' sec. în urmă';
1313
}
1414

15-
let min = Math.floor(diff / 60000); // convert diff to minutes
15+
let min = Math.floor(diff / 60000); // convertește diff în minute
1616
if (min < 60) {
17-
return min + ' min. ago';
17+
return min + ' min. în urmă';
1818
}
1919

20-
// format the date
21-
// add leading zeroes to single-digit day/month/hours/minutes
20+
// formatați data
21+
// adăugați zerouri de început unde este o singură cifră la zi/lună/ore/minute
2222
let d = date;
2323
d = [
2424
'0' + d.getDate(),
2525
'0' + (d.getMonth() + 1),
2626
'' + d.getFullYear(),
2727
'0' + d.getHours(),
2828
'0' + d.getMinutes()
29-
].map(component => component.slice(-2)); // take last 2 digits of every component
29+
].map(component => component.slice(-2)); // se iau ultimele 2 cifre din fiecare component
3030

31-
// join the components into date
31+
// uniți componentele în date
3232
return d.slice(0, 3).join('.') + ' ' + d.slice(3).join(':');
3333
}

Diff for: 1-js/05-data-types/11-date/8-format-date-relative/_js.view/test.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
describe("formatDate", function() {
2-
it("shows 1ms ago as \"right now\"", function() {
3-
assert.equal(formatDate(new Date(new Date - 1)), 'right now');
2+
it("arată 1ms în urmă ca \"chiar acum\"", function() {
3+
assert.equal(formatDate(new Date(new Date - 1)), 'chiar acum');
44
});
55

6-
it('"30 seconds ago"', function() {
7-
assert.equal(formatDate(new Date(new Date - 30 * 1000)), "30 sec. ago");
6+
it('"30 secunde în urmă"', function() {
7+
assert.equal(formatDate(new Date(new Date - 30 * 1000)), "30 sec. în urmă");
88
});
99

10-
it('"5 minutes ago"', function() {
11-
assert.equal(formatDate(new Date(new Date - 5 * 60 * 1000)), "5 min. ago");
10+
it('"5 minute în urmă"', function() {
11+
assert.equal(formatDate(new Date(new Date - 5 * 60 * 1000)), "5 min. în urmă");
1212
});
1313

14-
it("older dates as DD.MM.YY HH:mm", function() {
14+
it("date mai vechi precum DD.MM.YY HH:mm", function() {
1515
assert.equal(formatDate(new Date(2014, 2, 1, 11, 22, 33)), "01.03.14 11:22");
1616
});
1717

Diff for: 1-js/05-data-types/11-date/8-format-date-relative/solution.md

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
1-
To get the time from `date` till now -- let's substract the dates.
1+
Pentru a obține timpul scurs de la `date` până acum -- haideți să scădem datele.
22

33
```js run demo
44
function formatDate(date) {
5-
let diff = new Date() - date; // the difference in milliseconds
5+
let diff = new Date() - date; // diferența în milisecunde
66

7-
if (diff < 1000) { // less than 1 second
8-
return 'right now';
7+
if (diff < 1000) { // mai puțin de 1 secundă
8+
return 'chiar acum';
99
}
1010

11-
let sec = Math.floor(diff / 1000); // convert diff to seconds
11+
let sec = Math.floor(diff / 1000); // convertește diff în secunde
1212

1313
if (sec < 60) {
14-
return sec + ' sec. ago';
14+
return sec + ' sec. în urmă';
1515
}
1616

17-
let min = Math.floor(diff / 60000); // convert diff to minutes
17+
let min = Math.floor(diff / 60000); // convertește diff în minute
1818
if (min < 60) {
19-
return min + ' min. ago';
19+
return min + ' min. în urmă';
2020
}
2121

22-
// format the date
23-
// add leading zeroes to single-digit day/month/hours/minutes
22+
// formatați data
23+
// adăugați zerouri de început unde este o singură cifră la zi/lună/ore/minute
2424
let d = date;
2525
d = [
2626
'0' + d.getDate(),
2727
'0' + (d.getMonth() + 1),
2828
'' + d.getFullYear(),
2929
'0' + d.getHours(),
3030
'0' + d.getMinutes()
31-
].map(component => component.slice(-2)); // take last 2 digits of every component
31+
].map(component => component.slice(-2)); // se iau ultimele 2 cifre din fiecare component
3232

33-
// join the components into date
34-
return d.slice(0, 3).join('.') + ' ' + d.slice(3).join(':');
33+
// uniți componentele în date
34+
return d.slice(0, 3).join('.') + ' ' + d.slice(3).join(':'));
3535
}
3636

37-
alert( formatDate(new Date(new Date - 1)) ); // "right now"
37+
alert( formatDate(new Date(new Date(new Date - 1)) ); // "chiar acum"
3838

39-
alert( formatDate(new Date(new Date - 30 * 1000)) ); // "30 sec. ago"
39+
alert( formatDate(new Date(new Date(new Date - 30 * 1000)) ); // "30 sec. în urmă"
4040

41-
alert( formatDate(new Date(new Date - 5 * 60 * 1000)) ); // "5 min. ago"
41+
alert( formatDate(new Date(new Date(new Date - 5 * 60 * 1000)) ); // "5 min. în urmă"
4242

43-
// yesterday's date like 31.12.2016 20:00
44-
alert( formatDate(new Date(new Date - 86400 * 1000)) );
43+
// data de ieri precum 31.12.2016 20:00
44+
alert( formatDate(new Date(new Date(new Date - 86400 * 1000)) ) );
4545
```
4646
47-
Alternative solution:
47+
Soluție alternativă:
4848
4949
```js run
5050
function formatDate(date) {
@@ -58,7 +58,7 @@ function formatDate(date) {
5858
let diffMin = diffSec / 60;
5959
let diffHour = diffMin / 60;
6060

61-
// formatting
61+
// formatare
6262
year = year.toString().slice(-2);
6363
month = month < 10 ? '0' + month : month;
6464
dayOfMonth = dayOfMonth < 10 ? '0' + dayOfMonth : dayOfMonth;

Diff for: 1-js/05-data-types/11-date/8-format-date-relative/task.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@ importance: 4
22

33
---
44

5-
# Format the relative date
5+
# Formatați data relativă
66

7-
Write a function `formatDate(date)` that should format `date` as follows:
7+
Scrieți o funcție `formatDate(date)` care ar trebui să formateze `date` după cum urmează:
88

9-
- If since `date` passed less than 1 second, then `"right now"`.
10-
- Otherwise, if since `date` passed less than 1 minute, then `"n sec. ago"`.
11-
- Otherwise, if less than an hour, then `"m min. ago"`.
12-
- Otherwise, the full date in the format `"DD.MM.YY HH:mm"`. That is: `"day.month.year hours:minutes"`, all in 2-digit format, e.g. `31.12.16 10:00`.
9+
- Dacă a trecut mai puțin de 1 secundă din `date`, atunci `"chiar acum"`.
10+
- În caz contrar, dacă a trecut mai puțin de 1 minut de la `date`, atunci `"n sec. ago"`.
11+
- În caz contrar, dacă a trecut mai puțin de o oră, atunci `"m min. ago"`.
12+
- În caz contrar, data completă în formatul `"DD.MM.YY HH:mm"`. Adică: `"zi.lună.an ore:minute"`, toate în format de 2 cifre, de exemplu `31.12.16 10:00`.
1313

14-
For instance:
14+
De exemplu:
1515

1616
```js
17-
alert( formatDate(new Date(new Date - 1)) ); // "right now"
17+
alert( formatDate(new Date(new Date(new Date - 1)) ) ); // "chiar acum"
1818

19-
alert( formatDate(new Date(new Date - 30 * 1000)) ); // "30 sec. ago"
19+
alert( formatDate(new Date(new Date(new Date - 30 * 1000)) ); // "acum 30 sec."
2020

21-
alert( formatDate(new Date(new Date - 5 * 60 * 1000)) ); // "5 min. ago"
21+
alert( formatDate(new Date(new Date(new Date - 5 * 60 * 1000)) ); // "5 min în urmă"
2222

23-
// yesterday's date like 31.12.16 20:00
24-
alert( formatDate(new Date(new Date - 86400 * 1000)) );
23+
// data de ieri precum 31.12.16 20:00
24+
alert( formatDate(new Date(new Date(new Date - 86400 * 1000)) ) );
2525
```

0 commit comments

Comments
 (0)