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