- age
- daysIntoYear
- isOmrsDateStrict
- isOmrsDateToday
- isSameDay
- isVersionSatisfied
- retry
- toDateObjectStrict
- toOmrsDateFormat
- toOmrsDayDateFormat
- toOmrsIsoString
- toOmrsTimeString
- toOmrsTimeString24
- toOmrsYearlessDateFormat
- translateFrom
Ƭ DateInput: string
| number
| Date
▸ age(dateString
): string
Gets a human readable age represention of the provided date string.
Name | Type | Description |
---|---|---|
dateString |
string |
The stringified date. |
string
A human-readable string version of the age.
▸ daysIntoYear(date
): number
Gets the number of days in the year of the given date.
Name | Type | Description |
---|---|---|
date |
Date |
The date to compute the days within the year. |
number
The number of days.
▸ isOmrsDateStrict(omrsPayloadString
): boolean
This function is STRICT on checking whether a date string is the openmrs format. The format should be YYYY-MM-DDTHH:mm:ss.SSSZZ
Name | Type |
---|---|
omrsPayloadString |
string |
boolean
▸ isOmrsDateToday(date
): boolean
Name | Type | Description |
---|---|---|
date |
DateInput | Checks if the provided date is today. |
boolean
▸ isSameDay(firstDate
, secondDate
): boolean
Checks if two dates are representing the same day.
Name | Type | Description |
---|---|---|
firstDate |
Date |
The first date. |
secondDate |
Date |
The second date. |
boolean
True if both are located on the same day.
▸ isVersionSatisfied(requiredVersion
, installedVersion
): boolean
Name | Type |
---|---|
requiredVersion |
string |
installedVersion |
string |
boolean
▸ retry<T>(fn
, options?
): Promise
<T>
Executes the specified function and retries executing on failure with a custom backoff strategy defined by the options.
If not configured otherwise, this function uses the following default options:
- Retries 5 times beyond the initial attempt.
- Uses an exponential backoff starting with an initial delay of 1000ms.
throws
Rethrows the final error of running fn
when the function stops retrying.
Name |
---|
T |
Name | Type | Description |
---|---|---|
fn |
() => Promise <T> |
The function to be executed and retried on failure. |
options |
RetryOptions | Additional options which configure the retry behavior. |
Promise
<T>
The result of successfully executing fn
.
▸ toDateObjectStrict(omrsDateString
): Date
| null
Converts the object to a date object if it is a valid ISO date time string.
Name | Type |
---|---|
omrsDateString |
string |
Date
| null
▸ toOmrsDateFormat(date
, format?
): string
Formats the input as a date string. By default the format "YYYY-MMM-DD" is used.
Name | Type | Default value |
---|---|---|
date |
DateInput | undefined |
format |
string |
"YYYY-MMM-DD" |
string
▸ toOmrsDayDateFormat(date
): string
Formats the input as a date string using the format "DD - MMM - YYYY".
Name | Type |
---|---|
date |
DateInput |
string
▸ toOmrsIsoString(date
, toUTC?
): string
Formats the input as a date time string using the format "YYYY-MM-DDTHH:mm:ss.SSSZZ".
Name | Type | Default value |
---|---|---|
date |
DateInput | undefined |
toUTC |
boolean |
false |
string
▸ toOmrsTimeString(date
): string
Formats the input as a time string using the format "HH:mm A".
Name | Type |
---|---|
date |
DateInput |
string
▸ toOmrsTimeString24(date
): string
Formats the input as a time string using the format "HH:mm".
Name | Type |
---|---|
date |
DateInput |
string
▸ toOmrsYearlessDateFormat(date
): string
Formats the input as a date string using the format "DD-MMM".
Name | Type |
---|---|
date |
DateInput |
string
▸ translateFrom(moduleName
, key
, fallback?
): string
Name | Type |
---|---|
moduleName |
string |
key |
string |
fallback? |
string |
string