Documentation
¶
Overview ¶
Package format provides locale-aware formatting for numbers, currency, and dates. It depends on internal/i18n but has no PDF/layout dependencies.
Index ¶
- func ParseDate(dateStr string) (time.Time, error)
- type Formatter
- func (f *Formatter) FormatCurrency(value float64) string
- func (f *Formatter) FormatDate(dateStr string, longFormat bool) string
- func (f *Formatter) FormatDuration(hours float64) string
- func (f *Formatter) FormatFloat(value float64, decimals int) string
- func (f *Formatter) FormatPercent(value float64) string
- func (f *Formatter) FormatWorkWeek(dateStr string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
Formatter handles formatting of numbers, currency, and dates.
func (*Formatter) FormatCurrency ¶
FormatCurrency formats a float as currency with proper separators.
func (*Formatter) FormatDate ¶
FormatDate formats an ISO date string to a localized format. Input: "2026-03-02"; output depends on locale and longFormat flag.
func (*Formatter) FormatDuration ¶
FormatDuration formats hours as "HH:MM".
func (*Formatter) FormatFloat ¶
FormatFloat formats a float with the specified number of decimal places.
func (*Formatter) FormatPercent ¶
FormatPercent formats a percentage value.
func (*Formatter) FormatWorkWeek ¶
FormatWorkWeek formats a date as ISO work-week notation "W.D".