import TimeFormatter, {TimeCompiler, TIME_COMPILERS, HOUR_COMPILER, HOUR12_COMPILER, MINUTE_COMPILER, SECOND_COMPILER, MS_COMPILER, HOUR12_NZ_COMPILER, HOUR_NZ_COMPILER, AM_PM_COMPILER} from "ts-time-format/TimeFormatter";
(value: LocalTime, context?: any): string
(components: TemporalFormatComponent<LocalTime>[]): TimeFormatter
(pattern: string, compilers: Dictionary<TimeCompiler> = TIME_COMPILERS): TimeFormatter
readonly maxLength: number
(value: LocalTime, length: number, context: any = DEFAULT_TEMPORAL_CONTEXT): string
TIME_COMPILERS: Dictionary<TimeCompiler>
Default dictionary from pattern character to the respective compiler:
Character | Compiler | Examples per length | ||||
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
H | HOUR_COMPILER | 5 | 05 | |||
K | HOUR12_COMPILER | 5 | 05 | |||
m | MINUTE_COMPILER | 5 | 05 | |||
s | SECOND_COMPILER | 5 | 05 | |||
S | MS_COMPILER | 4 | 48 | 485 | ||
h | HOUR12_NZ_COMPILER | 5 | 05 | |||
k | HOUR_NZ_COMPILER | 5 | 05 | |||
a | AM_PM_COMPILER | AM |
HOUR_COMPILER: TimeCompiler
Depending on length:
Default pattern character is "H".
HOUR12_COMPILER: TimeCompiler
Depending on length:
Default pattern character is "K".
MINUTE_COMPILER: TimeCompiler
Depending on length:
Default pattern character is "m".
SECOND_COMPILER: TimeCompiler
Depending on length:
Default pattern character is "s".
MS_COMPILER: TimeCompiler
Writes the same number of the most significant fractions of a second as the length, truncating them down. For example, writes "4", "48" and "485" for 485 milliseconds and lengths 1, 2 and 3 respectively.
Default pattern character is "S".
HOUR12_NZ_COMPILER: TimeCompiler
If time.hour % 12 === 0, writes "12". Else behaves like HOUR12_COMPILER.
Default pattern character is "h".
HOUR_NZ_COMPILER: TimeCompiler
If time.hour === 0, writes "24". Else behaves like HOUR_COMPILER.
Default pattern character is "k".
AM_PM_COMPILER: TimeCompiler
Writes AM or PM. AM starts at 00:00:00.000 and ends at 11:59:59.999. PM starts at 12:00:00.000 and ends at 23:59:59.999.