Skip to content

Commit 1d335aa

Browse files
committed
- Translate date/time tasks into Arabic.
1 parent e2d6b26 commit 1d335aa

17 files changed

Lines changed: 94 additions & 94 deletions

File tree

1-js/05-data-types/11-date/1-new-date/solution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
The `new Date` constructor uses the local time zone. So the only important thing to remember is that months start from zero.
1+
يقوم الباني `new Date` باستخدام المنطقة الزمنية المحلية. لذا فإن الشيء المهم الوحيد الذي يجب تذكره الآن هو أن الأشهر تبدأ من الصفر وليس من الواحد.
22

3-
So February has number 1.
3+
لذلك يتم تمثيل شهر شباط (فبراير) بالرقم 1.
44

55
```js run
66
let d = new Date(2012, 1, 20, 3, 12);
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
importance: 5
1+
الأهمية: 5
22

33
---
44

5-
# Create a date
5+
# إنشاء تاريخ
66

7-
Create a `Date` object for the date: Feb 20, 2012, 3:12am. The time zone is local.
7+
قم بإنشاء غرض `Date` للتاريخ: Feb 20, 2012, 3:12am. باعتبار المنطقة الزمنية هي المنطقة المحلية.
88

9-
Show it using `alert`.
9+
قم بإظهار الغرض المنشأ باستخدام `alert`.

1-js/05-data-types/11-date/2-get-week-day/solution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
The method `date.getDay()` returns the number of the weekday, starting from sunday.
1+
تقوم الطريقة `()date.getDay` بإرجاع رقم يوم الأسبوع المقابل، بدءاً من يوم الأحد.
22

3-
Let's make an array of weekdays, so that we can get the proper day name by its number:
3+
لنقم بإنشاء مصفوفة من أيام الأسبوع، حتى نتمكن من الحصول على اسم اليوم المقابل من خلال رقمه:
44

55
```js run demo
66
function getWeekDay(date) {
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
importance: 5
1+
الأهمية: 5
22

33
---
44

5-
# Show a weekday
5+
# إظهار أيام الأسبوع
66

7-
Write a function `getWeekDay(date)` to show the weekday in short format: 'MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU'.
7+
قم بكتابة الدالة `getWeekDay(date)` التي تقوم بإظهار يوم الأسبوع بتنسيق قصير: 'MO'، 'TU'، 'WE'، 'TH'، 'FR'، 'SA'، 'SU'.
88

9-
For instance:
9+
على سبيل المثال:
1010

1111
```js no-beautify
1212
let date = new Date(2012, 0, 3); // 3 Jan 2012
13-
alert( getWeekDay(date) ); // should output "TU"
13+
alert( getWeekDay(date) ); // يجب أن يظهر "TU"
1414
```

1-js/05-data-types/11-date/3-weekday/_js.view/solution.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function getLocalDay(date) {
22

33
let day = date.getDay();
44

5-
if (day == 0) { // weekday 0 (sunday) is 7 in european
5+
if (day == 0) { // اليوم 0 (الأحد) هو اليوم رقم 7 في أوروبا
66
day = 7;
77
}
88

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
importance: 5
1+
الأهمية: 5
22

33
---
44

5-
# European weekday
5+
# أيام الأسبوع الأوروبية
66

7-
European countries have days of week starting with Monday (number 1), then Tuesday (number 2) and till Sunday (number 7). Write a function `getLocalDay(date)` that returns the "European" day of week for `date`.
7+
تبدأ أيام الأسبوع في البلدان الأوروبية من يوم الإثنين (الرقم 1) ثم الثلاثاء (الرقم 2) وحتى يوم الأحد (رقم 7). اكتب دالة `getLocalDay(date)` تقوم بإرجاع يوم الأسبوع الأوروبي لتاريخ معين `date`.
88

99
```js no-beautify
1010
let date = new Date(2012, 0, 3); // 3 Jan 2012
11-
alert( getLocalDay(date) ); // tuesday, should show 2
11+
alert( getLocalDay(date) ); // الثلاثاء، يجب إظهار 2
1212
```

1-js/05-data-types/11-date/4-get-date-ago/solution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The idea is simple: to substract given number of days from `date`:
1+
الفكرة بسيطة: نقوم بطرح عدد معين من الأيام من التاريخ `date`:
22

33
```js
44
function getDateAgo(date, days) {
@@ -7,9 +7,9 @@ function getDateAgo(date, days) {
77
}
88
```
99

10-
...But the function should not change `date`. That's an important thing, because the outer code which gives us the date does not expect it to change.
10+
...ولكن يجب أن لا يغير التابع قيمة غرض التاريخ الممرر `date`. وهذه ملاحظة مهمة، لأن الكود الخارجي الذي يقوم بتمرير قيمة الغرض لا يتوقع أن يقوم التابع الخاص بنا بتعديل هذه القيمة.
1111

12-
To implement it let's clone the date, like this:
12+
لتنفيذ الطلب السابق، دعنا نقم باستنساخ التاريخ، كالتالي:
1313

1414
```js run demo
1515
function getDateAgo(date, days) {
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
importance: 4
1+
الأهمية: 4
22

33
---
44

5-
# Which day of month was many days ago?
5+
# أي يومٍ من الشهر كان قبل عدة أيام؟
66

7-
Create a function `getDateAgo(date, days)` to return the day of month `days` ago from the `date`.
7+
قم بإنشاء دالة `getDateAgo(date, days)` تقوم بإرجاع يوم الشهر `days` المنصرم من التاريخ `date`.
88

9-
For instance, if today is 20th, then `getDateAgo(new Date(), 1)` should be 19th and `getDateAgo(new Date(), 2)` should be 18th.
9+
على سبيل المثال، إذا كان اليوم الحالي هو 20، فيجب أن يرد الاستدعاء `getDateAgo(new Date(), 1)` القيمة 19 ويرد الاستدعاء `getDateAgo(new Date(), 2)` القيمة 18.
1010

11-
Should work reliably for `days=365` or more:
11+
يجب أن يعمل التابع بشكل فعال في حال كانت القيمة `days=365` أو أكثر:
1212

1313
```js
1414
let date = new Date(2015, 0, 2);
@@ -18,4 +18,4 @@ alert( getDateAgo(date, 2) ); // 31, (31 Dec 2014)
1818
alert( getDateAgo(date, 365) ); // 2, (2 Jan 2014)
1919
```
2020

21-
P.S. The function should not modify the given `date`.
21+
ملاحظة: يجب أن لا يقوم التابع بتعديل قيمة الغرض `date` الممرر.

1-js/05-data-types/11-date/5-last-day-of-month/solution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Let's create a date using the next month, but pass zero as the day:
1+
لنقم بإنشاء غرض من التاريخ باستخدام الشهر التالي، ولكن لنقم بتمرير 0 الممثل لليوم:
22
```js run demo
33
function getLastDayOfMonth(year, month) {
44
let date = new Date(year, month + 1, 0);
@@ -10,4 +10,4 @@ alert( getLastDayOfMonth(2012, 1) ); // 29
1010
alert( getLastDayOfMonth(2013, 1) ); // 28
1111
```
1212

13-
Normally, dates start from 1, but technically we can pass any number, the date will autoadjust itself. So when we pass 0, then it means "one day before 1st day of the month", in other words: "the last day of the previous month".
13+
تبدأ التواريخ عادة من 1، ولكن من الناحية الفنية يمكننا تمرير أية رقم، وسيقوم غرض التاريخ بتصحيح نفسه بشكل تلقائي، لذلك وعند تمرير القيمة 0، فهي تعني "يوم واحد قبل اليوم الأول من الشهر"، بمعنى آخر: "اليوم الأخير من الشهر السابق".
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
importance: 5
1+
الأهمية: 5
22

33
---
44

5-
# Last day of month?
5+
# اليوم الأخير من الشهر؟
66

7-
Write a function `getLastDayOfMonth(year, month)` that returns the last day of month. Sometimes it is 30th, 31st or even 28/29th for Feb.
7+
قم بكتابة دالة `getLastDayOfMonth(year, month)` تقوم برد اليوم الأخير من الشهر. أحياناً تكون القيمة 30، 31 أو حتى 28/29 في حال كان الشهر هو شباط.
88

9-
Parameters:
9+
الوسطاء:
1010

11-
- `year` -- four-digits year, for instance 2012.
12-
- `month` -- month, from 0 to 11.
11+
- `year` -- أربعة أرقام لتمثيل السنة، على سبيل المثال 2012.
12+
- `month` -- الشهر، من 0 وحتى 11.
1313

14-
For instance, `getLastDayOfMonth(2012, 1) = 29` (leap year, Feb).
14+
على سبيل المثال، `getLastDayOfMonth(2012, 1) = 29` (سنة كبيسة، شباط/فبراير).

0 commit comments

Comments
 (0)