Module: modules/utils

Utility functions for UI state management and formatting.

Source:

Methods

(static) clearMessages(errorElement, successElement)

Hides both error and success messages.

Parameters:
Name Type Description
errorElement HTMLElement

The error message container element

successElement HTMLElement

The success message container element

Source:

(static) displayError(message, errorElement, successElement)

Displays an error message and hides the success message.

Parameters:
Name Type Description
message string

The error message to display

errorElement HTMLElement

The error message container element

successElement HTMLElement

The success message container element

Source:

(static) displaySuccess(message, successElement, errorElement)

Displays a success message and hides the error message.

Parameters:
Name Type Description
message string

The success message to display

successElement HTMLElement

The success message container element

errorElement HTMLElement

The error message container element

Source:

(static) formatDate(dateString) → {string}

Formats a date string to a locale string.

Parameters:
Name Type Description
dateString string

The date string to format

Source:
Returns:

The formatted date string or 'N/A' if invalid

Type
string

(static) setLoadingState(button, isLoading)

Toggles the loading state of a button (disables/enables and updates text).

Parameters:
Name Type Description
button HTMLButtonElement

The button element to update

isLoading boolean

Whether the button should be in loading state

Source: