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

DateTime():isBefore()

يتحقق ما إذا كان كائن DateTime الحالي قبل كائن DateTime آخر.

التوقيع

isBefore(other: DateTime): boolean

المعاملات

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