Utils

The Design System exposes some utilities that you may find useful when developing custom views or components. You can import each utility individually from the @sema4ai/components/utils path.

formatDate

Returns formatted date or date time string with optional format options.

Code block

formatRelativeDate

Returns formatted relative time if difference is less than 1 hour, otherwise returns regular formatted date.

Code block

dataFuzzySearcher

Local data fuzzy search helper util

Code block

dataSearcher

Local data search helper util

Code block

dataSorter

Local data sorting helper util

Code block

dataFilter

Local data filtering helper util

Code block