ascending( )


Adds a sort to a query, sorting by the specified properties in ascending order.

The ascending() function refines an EventsQueryBuilder to sort in ascending order of the specified properties. If you specify more than one property, ascending() sorts the results in ascending order by each property in the order they are listed.

You can sort the following types:

  • Date: Sorts by date and time.
  • String: Sorts lexicographically, so "abc" comes after "XYZ".

If a property contains a number as a String, that value will be sorted alphabetically and not numerically. Items that do not have a value for the specified sort property are ranked lowest.

Method Declaration
Copy
Method Parameters
propertyNameArray<string>Required

The properties used in the sort.

Supported properties:

  • title
  • slug
  • scheduling.startTime
  • scheduling.endTime
  • _createdDate
  • _updatedDate
Returns
Return Type:EventsQueryBuilder
Did this help?