Skip to content

Data Types

Data Types used in Template Engine


This article describes all the data types used in the JuniperBot Template Engine.

Some methods may have an invoke quota. Quota means how many times this method can be invoked per single template. Attempts to invoke that exceed the specified quota will be ignored and will not take any action.

literals#

Literals are the most basic expressions, check the table below:

Name Example
Float -1.5, 5.7, 1.0
Integer -10, 56, 0
Null Reference null
Boolean true или false
String "string in double brackets"
'apostrophe string'
Character 'g'

Lists#

There is the one way to specify a list in Template Engine by enumeration, you need to provide every single element of the list, as shown below:

[1, 2, 3]

Maps#

It is also possible to represent collections of key and value pairs, so called maps, where keys can either be Identifiers or Strings and values can take form of any kind of expression:

{ key1: 'value1', 'key 2': 'value2' }

Keep in mind that identifiers used to represent the key elements are not used as variable placeholders, instead, they are converted to their String representation. For example, the identifier key1 shown above will be converted to the String value "key1".

DateTime#

This data type represents date and time and allows to manipulate them.

Properties#

Property Type Description
millis Number Milliseconds
millisOfDay Number Millis of day
millisOfSecond Number Millis of second
secondOfDay Number Second of day
secondOfMinute Number Second of minute
minuteOfDay Number Minute of day
minuteOfHour Number Minute of hour
hourOfDay Number Hour of day
dayOfMonth Number Day of month
dayOfWeek Number Day of week
dayOfYear Number Day of year
weekOfWeekyear Number Week of weekyear
weekyear Number Week year1
monthOfYear Number Month of year
year Number Year
yearOfCentury Number Year of century
yearOfEra Number Year of era
centuryOfEra Number Century of era
era Number Era
zoneOffset Number Timezone offset in milliseconds
isAfterNow Boolean true if this date is in future
isBeforeNow Boolean true if this date is in past

Methods#

The methods below do not modify the current instance, but return a new one.

Method Parameters Returns Description
plusMillis(Amount) Number DateTime Returns a copy of this datetime plus the specified number of millis.
plusSeconds(Amount) Number DateTime Returns a copy of this datetime plus the specified number of seconds.
plusMinutes(Amount) Number DateTime Returns a copy of this datetime plus the specified number of minutes.
plusHours(Amount) Number DateTime Returns a copy of this datetime plus the specified number of hours.
plusDays(Amount) Number DateTime Returns a copy of this datetime plus the specified number of days.
plusWeeks(Amount) Number DateTime Returns a copy of this datetime plus the specified number of weeks.
plusMonths(Amount) Number DateTime Returns a copy of this datetime plus the specified number of months
plusYears(Amount) Number DateTime Returns a copy of this datetime plus the specified number of years.
minusMillis(Amount) Number DateTime Returns a copy of this datetime minus the specified number of millis.
minusSeconds(Amount) Number DateTime Returns a copy of this datetime minus the specified number of seconds.
minusMinutes(Amount) Number DateTime Returns a copy of this datetime minus the specified number of minutes.
minusHours(Amount) Number DateTime Returns a copy of this datetime minus the specified number of hours.
minusDays(Amount) Number DateTime Returns a copy of this datetime minus the specified number of days.
minusWeeks(Amount) Number DateTime Returns a copy of this datetime minus the specified number of weeks.
minusMonths(Amount) Number DateTime Returns a copy of this datetime minus the specified number of months.
minusYears(Amount) Number DateTime Returns a copy of this datetime minus the specified number of years.
isAfter(Date) DateTime Boolean Is this date strictly after the specified date.
isBefore(Date) DateTime Boolean Is this date strictly before the specified date.


  1. Because the first day of the first week does not always fall on the first day of the year, sometimes the week-year will differ from the month year.

    For example, in the US, the week that contains Jan 1 is always the first week. In the US, weeks also start on Sunday. If Jan 1 was a Monday, Dec 31 would belong to the same week as Jan 1, and thus the same week-year as Jan 1. Dec 30 would have a different week-year than Dec 31.