Files
dashboard/config/formatting.config.ts
Alberto-Audrix 32a36cceff
CI / lint-and-test (push) Canceled after 0s
first commit
2026-07-28 08:55:05 +07:00

56 lines
1.4 KiB
TypeScript

/**
* Centralized formatting configuration for the application.
*
* This configuration ensures consistent number and date formatting
* across all components and utilities.
*/
export const FORMATTING_CONFIG = {
/**
* Locale for number formatting.
* 'id-ID' provides period (.) as thousands separator and comma (,) as decimal separator.
* Examples: 1.234 | 1.234,56
*/
NUMBER_LOCALE: 'id-ID' as const,
/**
* Locale for date/time formatting.
* Keeps Indonesian locale for better UX consistency.
*/
DATETIME_LOCALE: 'id-ID' as const,
/**
* Default decimal places by data type.
*/
DECIMALS: {
/** Weight in kilograms (e.g., 1.5 kg) */
WEIGHT_KG: 1,
/** Weight in grams (e.g., 1,234 g) */
WEIGHT_G: 0,
/** FCR (Feed Conversion Ratio) values (e.g., 1.567) */
FCR: 3,
/** EEF (European Efficiency Factor) values (e.g., 123.45) */
EEF: 2,
/** Percentage displays (e.g., 85.3%) */
PERCENTAGE: 1,
/** Temperature in Celsius (e.g., 32.5°C) */
TEMPERATURE: 1,
/** Humidity percentage (e.g., 65.5%) */
HUMIDITY: 1,
},
/**
* Fallback text for null/undefined/unavailable values.
*/
FALLBACK: {
/** Default for null/undefined numeric values */
NULL_VALUE: '-',
/** Explicit "no data available" state */
NO_DATA: 'N/A',
/** Loading state indicator */
LOADING: '...',
},
} as const;
export type FormattingConfig = typeof FORMATTING_CONFIG;