/** * @license * Copyright (c) 2025 Handsoncode. All rights reserved. */ import { Config } from '../Config'; import { DateTimeHelper, SimpleDateTime, SimpleTime } from '../DateTimeHelper'; import { RawScalarValue } from '../interpreter/InterpreterValue'; import { Maybe } from '../Maybe'; export declare function format(value: number, formatArg: string, config: Config, dateHelper: DateTimeHelper): RawScalarValue; export declare function padLeft(number: number | string, size: number): string; export declare function padRight(number: number | string, size: number): string; /** * Default `stringifyDuration` callback — formats a duration value against an * Excel-style time format string (e.g. `[hh]:mm:ss`). * * Returns `undefined` for format strings that are not duration formats so the * dispatcher in `format()` can fall through to other handlers. * * **LCID currency-tag guard** — sibling to the same guard in * `defaultStringifyDateTime`; explicitly returns `undefined` for Excel * currency tags `[$SYMBOL-LCID]` because the SYMBOL portion contains * duration-token letters (`H` in CHF/HUF, `m` in AMD/HMD) that * `parseForDateTimeFormat` would otherwise interpret as time tokens and * mangle the output. See `defaultStringifyDateTime` for the full * symbol-vs-locale-modifier rationale and the historical pre-HF-24 * behaviour the guard corrects. * * @param time parsed duration value to render * @param formatArg Excel-style format string * @returns formatted string, or `undefined` to defer to the next dispatch step */ export declare function defaultStringifyDuration(time: SimpleTime, formatArg: string): Maybe; /** * Default `stringifyDateTime` callback — formats a date/time value against an * Excel-style format string (e.g. `YYYY-MM-DD HH:mm:ss`). * * Returns `undefined` for format strings that are not date/time formats so the * dispatcher in `format()` can fall through to `parseForNumberFormat` (or to a * user-supplied `stringifyCurrency` callback for currency-tagged formats). * * **LCID currency-tag guard** — explicitly returns `undefined` for Excel * currency tags `[$SYMBOL-LCID]` (non-empty SYMBOL portion). Without the * guard, `parseForDateTimeFormat` greedily consumes letters like `D`/`M`/`S`/`Y`/`H` * inside the currency code (e.g. `D` in USD, `H` in CHF, `M`+`D` in AMD), * mangling the output of an `[$USD-409] #,##0.00` format into * `[$US9-409] #,##0.00` because `D` is read as a day token. The pre-HF-24 * behaviour was to mis-format; the guarded return is the deliberate * correction, not a regression. Bit-for-bit compatibility is preserved for * every non-currency format (dates, durations, `$#,##0.00`, etc.). * * The guard pattern (`/\[\$[^\-\]]+-/`) requires ≥1 character between `[$` * and `-` so it distinguishes currency tags (`[$USD-409]`, `[$€-2]`) from * Excel's locale-only modifier (`[$-409]`, `[$-F800]`), which is valid on * date/time formats and must continue to flow through this function. * * @param dateTime parsed date/time value to render * @param formatArg Excel-style format string * @returns formatted string, or `undefined` to defer to the next dispatch step */ export declare function defaultStringifyDateTime(dateTime: SimpleDateTime, formatArg: string): Maybe; /** * Default implementation of the `stringifyCurrency` config option. * * Returning `undefined` instructs the formatter to fall through to the * built-in number formatter, preserving HyperFormula's zero-dependency * default behavior. Replace this default by setting the * [`stringifyCurrency`](../../api/interfaces/configparams.md#stringifycurrency) * config option. * * @param _value - the numeric value to format (unused in default). * @param _formatArg - the format string passed to `TEXT` (unused in default). * @returns `undefined` — caller should fall through to the built-in formatter. */ export declare function defaultStringifyCurrency(_value: number, _formatArg: string): Maybe;