إنتقل إلى المحتوى الرئيسي

DateTime():isSameOrBefore()

يتحقق ما إذا كان كائن DateTime الحالي مطابقًا لكائن DateTime آخر أو يأتي قبله.

التوقيع

isSameOrBefore(other: DateTime): boolean

المعاملات

المعاملالنوعالوصف
otherDateTimeكائن 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))