- Home [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
- Getting started
- Use cases
-
API
- Object types
-
Data types
- AccountType
- DynamicFieldType
- EmailType
- OrganisationStructureItemType
- PhoneType
- ReplacementType
- ServiceStatus
- UserStatus
- WatermarkPages
- WatermarkPosition
- AccountFieldTyped
- AccountFieldVoid
- ApplicationField
- Cell
- ClientEventField
- CookieOptions
- DatetimeFieldData
- DynamicBindingField
- DynamicBindingFields
- EnumField
- ErrorArgs
- ErrorObject
- FileField
- FloatFieldData
- GroupStatusField
- HttpResponse
- ImageField
- Language
- MailMessageAddress
- MailMessageAttachment
- MoneyFieldData
- Navigator
- Page
- ParseSpreadsheetOptions
- ParseSpreadsheetResponse
- RefItem
- ReportField
- ReportRef
- Role
- RoleField
- Row
- ServiceStatusInfo
- StaticApplicationFieldData
- StatusField
- TAccount
- TClientEvent
- TDate
- TDatetime
- TDuration
- TEmail
- TEnum
- TFullName
- TMoney
- TPhone
- TReport
- TStatus
- TTable
- TTime
- TTimezone
- TTimezones
- TableField
- UserField
- UserFieldData
- ValidationResult
- Watermark
- WidgetRefWithValues
- ReplacementTypeEnumBase
- RoleType
- TApplication
- TBoolean
- TCategory
- TFile
- TFloat
- TImage
- TJSON
- TLink
- TOAuth2
- TRole
- TString
- TUser
- Global constants
- Work with apps
- Web requests
- Access permissions
- Document flow
- Live Chats
- “Code” widget
- Signatures
- Business calendars
- Integration with IP telephony
- Integration with email marketing services
Date
Constructors:
new TDate(): TDate; new TDate(year: number, month: number, day: number): TDate;
alues of this type are immutable, so mutation methods return an updated value without modifying the original.
const date = new TDate(2022, 2, 24); // 2022-02-24 const newDate = date.addDate(0, 1, 5); // 2022-03-29
Note that the type TDate оdiffers from the built-in JavaScript type
Date
. This type contains only date information, without the time of day.Hierarchy
Properties
Readonly day
Day.
Example:
const date = new TDate(2021, 1, 20); const day = date.day;
Readonly month
Month.
Example:
const date = new TDate(2021, 1, 20); const month = date.month;
Readonly year
Year.
Example:
const date = new TDate(2021, 1, 20); const year = date.year;
Methods
addDate
Add a date.
Example:
const date = new TDate(2021, 1, 20); const newDate = date.addDate(0, 1, 5);
Parameters
years: number
month: number
days: number
Returns TDate
after
Checks whether the specified date is later than another.
Example:
const startDate = new TDate(2021, 1, 20); const endDate = new TDate(2021, 1, 21); const after = startDate.after(endDate); // false
Parameters
date: TDatetime | TDate
Returns boolean
afterOrEqual
Checks whether the current date is the same as or later than
date
.Example:
const startDate = new TDate(2021, 1, 20); const endDate = new TDate(2021, 1, 21); const equal = startDate. afterOrEqual(endDate); // false
Parameters
date: TDatetime | TDate
Returns boolean
asDatetime
Conversion to date and time.
Returns the date and time in the specified time zone or in the current one if the time zone is not specified (by default, the company’s time zone).
Example:
const date = new TDate(2021, 1, 20); const time = new TTime(3, 15, 0, 0); const datetime = date.asDatetime(time);
Parameters
time: TTime
Optional tz: TTimezone
Returns TDatetime
before
Checks whether the specified date is earlier than another.
Example:
const startDate = new TDate(2021, 1, 20); const endDate = new TDate(2021, 1, 21); const before = startDate.before(endDate); // true
Parameters
date: TDatetime | TDate
Returns boolean
beforeOrEqual
Checks whether the current date is the same as or earlier than
date
.Example:
const startDate = new TDate(2021, 1, 20); const endDate = new TDate(2021, 1, 21); const equal = startDate. beforeOrEqual(endDate); // true
Parameters
date: TDatetime | TDate
Returns boolean
equal
Checks whether two date objects have the same value.
Example:
const startDate = new TDate(2021, 1, 20); const endDate = new TDate(2021, 1, 21); const equal = startDate.equal(endDate); // false
Parameters
date: TDatetime | TDate
Returns boolean
format
Converts the date to the required format.
The default format is
YYYY-MM-DD
. Use the following options to format dates:YYYY
,y
is for the year.MM
is for the month with a leading zero.M
is for the month without a leading zero.DD
is for the day with a leading zero.D
is for the day without a leading zero.d
is for the day of the week. Example:const date = new TDate(2021, 1, 20); const formatDate = date.format();
Parameters
Optional format: undefined | string
Returns string
Properties
Methods