← All packages

@searsuite/sear-domain-format

Portable cell-format values and formatting contracts.

Format a value

interfaceSpreadsheetFormatDisplay

Display metadata selected from one Excel number-format section.

typeSpreadsheetFormatValue
type SpreadsheetFormatValue = string | number | boolean | null | undefined | SpreadsheetTextValue | SpreadsheetErrorValue | readonly SpreadsheetFormatValue[] | readonly readonly SpreadsheetFormatValue[][]
variableDefaultSpreadsheetFormatLocale
DefaultSpreadsheetFormatLocale: SpreadsheetFormatLocale
functionformatDollar
formatDollar(number: number, decimals: number, currencySymbol?: string): string
functionformatExcelDateTime
formatExcelDateTime(serial: number, pattern?: string, locale?: SpreadsheetFormatLocale): string

Formats an Excel date/time serial with date, clock, and elapsed-time tokens.

functionformatExcelDisplay
formatExcelDisplay(value: SpreadsheetFormatValue, formatText: string, locale?: SpreadsheetFormatLocale): SpreadsheetFormatDisplay | SpreadsheetErrorValue | null

Formats a scalar value and preserves section-level visual metadata.

functionformatExcelText
formatExcelText(value: SpreadsheetFormatValue, formatText: string, locale?: SpreadsheetFormatLocale): string | SpreadsheetErrorValue | null
functionformatFixed
formatFixed(number: number, decimals: number, noCommas: boolean): string
functionformatSpreadsheetNumber
formatSpreadsheetNumber(value: number, code: string, locale?: SpreadsheetFormatLocale): string | null

Parse dates and numbers

functionexcelDatePartsFromSerial
excelDatePartsFromSerial(serial: number): ExcelDateParts | null
functionparseNumberValue
parseNumberValue(source: string, decimalSeparator?: string, groupSeparator?: string): number | null