Skip to content

innodev-au/appianplugin-java-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An Appian plugin containing date and time utility functions, using concepts and behaviour from Java Time (JSR-310).

Currently, it provides functions to parse and validate text representation of local dates. Future versions may add additional functions.

Functions

The following functions are currently provided:

  • time_parseLocalDate: Parses a text representation of a local date. If the representation is invalid or constitutes an invalid date, an exception is thrown.
  • time_isValidLocalDate: Returns a boolean indicating whether the provided text is a valid representation of a date given the date pattern.

A local date is not associated to a particular time zone. It can be used to represent dates where a given time zone is assumed or to represent stand-alone date values, such as a date of birth. In Appian, a local date is known as a Date.

The date pattern follows Java's format. You may use a value such as 'yyyy-M-d'. Use 'y' for year digits, 'M' for month digits (note that it's in uppercase) and 'd' for day-of-month digits. The pattern follows what's defined in https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns, with the restriction that only date-related characters are allowed. For instance, time pattern characters such as 'H' are not allowed.

Functions are prefixed with time_ as a rudimentary way to avoid names clashing with functions from other plugins.

Version

The implementation is stable, hence the version number is 1.0.0.

This plugin has been tested in Appian 18.1 and 17.4 but will most likely work in newer as well as older Appian versions.

Java Time (JSR-310) was introduced in Java 8. However, this implementation runs in Appian instances with older Java versions.

Similar Plugins

Another plugin, The Date and Time Utilities plugin, also provides date parsing and validation functions. However, the functionality in this project differs in that:

  • This project uses Java Time terminology and behaviour
  • In this project, an arbitrary date format can be specified; the other plugin uses a fixed set of patterns.
  • The return value of time_parseLocalDate is a local date (i.e., an Appian Date); the other plugin returns an instant (i.e. an Appian Date and Time).
  • In this project, if the parse fails, an exception is thrown. This is by design. If don't know whether the provided date will be valid, call time_isValidLocalDate before.