DateTime():isBefore()
يتحقق ما إذا كان كائن DateTime الحالي قبل كائن DateTime آخر.
التوقيع
isBefore(other: DateTime): boolean
المعاملات
| المعامل | النوع | الوصف |
|---|---|---|
other | DateTime | كائن DateTime الآخر للمقارنة به. |
القيمة المعادة
- النوع:
boolean trueإذا كانDateTimeالحالي يأتي قبلotherبشكل صارم، وfalseبخلاف ذلك.
أمثلة
local date1 = DateTime(2024, 1, 5)
local date2 = DateTime(2024, 1, 10)
local result1 = date1:isBefore(date2) -- result will be true
toast(tostring(result1))
local result2 = date2:isBefore(date1) -- result will be false
toast(tostring(result2))