Format Class Reference

Format.date(milliseconds) Format.datetime(milliseconds) Format.time(milliseconds) Format.dayOfWeek(milliseconds) Format.month(milliseconds) Format.address(street, city, state, zipcode, country) Format.price(amount, currency, fractionDigits) Format.phone(number) Format.duration(minutes)

This class is a helper class to format different values as a nicely formatted string. All methods in this class are static.

Format.address(street, city, state, zipcode, country)

Returns a string formatted address from the street, city ,state, zipcode, country (string) parameters, using local settings

var address = Format.address(contact.street, contact.city, contact.state, contact.zipcode, contact.country);
List.addItemLabel("Address", address, "App.map({address})", "icon:pinpoint");

Format.price(amount, currency, fractionDigits)

Returns a string formmated price

var price1 = Format.price(4543.4398); // will return $4543.44
var price2 = Format.price(4543, "EUR"); // will return 4543.00€
var price3 = Format.price(4543.645, "EUR", 0); // will return 4543€
var price4 = Format.price(4543.645, "AUD", 1); // will return A$4543.1

Format.phone(number)

Returns a formatted phone string from the number (string ) based on the user locale setting.

List.addItemLabel("Mobile", Format.phone(contact.phone), "App.call({contact.phone})");

Format.date(milliseconds)

Returns the formatted string date for milliseconds (number) using the local timezone and local settings

List.addItemLabel("Start Date", Format.date(task.date));

Format.datetime(milliseconds)

Returns the formatted date and time string for milliseconds (number) using the local timezone and local settings

List.addItemLabel("Start Date", Format.datetime(task.date));

Format.time(milliseconds)

Returns the formatted time string for milliseconds (number) using the local timezone and local settings

List.addItemLabel("Start Time", Format.time(event.startdate));

Format.dayOfWeek(milliseconds)

Returns the day of the week (string) for milliseconds (number) using the local timezone and local settings

List.addHeader(Format.dayOfWeek(date) + "" + Format.date(date));

Format.month(milliseconds)

Returns the month (string) for milliseconds (number) using the local timezone and local settings

List.addHeader(Format.month(date));

Format.duration(minutes)

Returns the formttaed duration (string) corresponding to minutes (number) using the local settings

List.addLabel("Task Duration", Format.duration(task.nbminutes));