UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

88 lines 3.52 kB
import { PipeTransform } from '@angular/core'; import { AggregationOption } from '@c8y/ngx-components'; import * as i0 from "@angular/core"; /** * A pipe that adjusts the aggregated time range based on the aggregation type. * * ```html * '9:00' | adjustAggregatedTimeRange: config.aggregation (e.g.:HOURLY) * ``` * The output will be '9:00-10:00'. */ export declare class AdjustAggregatedTimeRangePipe implements PipeTransform { /** * Transforms the input time based on the aggregation type. * @param inputTime The input time string. * @param aggregationType The type of aggregation (optional). * @returns The transformed time string. */ transform(inputTime: string, aggregationType?: AggregationOption): string; /** * Creates a date object from the input time string. * @param inputTime The input time string. * @returns The created Date object. */ private createDateFromInput; /** * Validates if the time string matches the required format and has valid values. * @param time The time string to validate. * @param originalInput The original input string (including AM/PM if present). * @throws Error if the time format is invalid or values are out of range. */ private validateTimeFormat; private validateTimeParts; private validateTimeDigits; private parseTimeComponents; private validateTimeRanges; private validateTimeFormat24Hour; /** * Checks if string contains only digits and is 1-2 characters long. * @param value String to check * @returns boolean indicating if string is valid */ private isValidNumberString; /** * Checks if the input time has AM/PM markers. * @param input The input time string to check. * @returns boolean indicating if the input contains AM/PM. */ private hasAmPm; /** * Adjusts the date for PM times by adding 12 hours when necessary. * @param date The date object to adjust. * @param isPM Boolean indicating if the time is PM. * @returns The adjusted Date object. */ private adjustForPMTime; /** * Checks if the input time is in twelve hours format. * @param inputTime The input time string. * @returns True if the input time is in twelve hours format, false otherwise. */ private isTwelveHoursFormat; /** * Gets the hourly time range for the given date. * @param date The date object. * @param twelveHoursFormat Indicates whether to use twelve hours format. * @returns The hourly time range string. */ private getHourlyTimeRange; /** * Gets the minutely time range for the given date. * @param date The date object. * @param twelveHoursFormat Indicates whether to use twelve hours format. * @returns The minutely time range string. */ private getMinutelyTimeRange; /** * Formats the given date into a time string. * @param date The date to format. * @param usePeriod Indicates whether to include the period (AM/PM) in the formatted time. * @param useHourOnly Indicates whether to include only the hour part in the formatted time. * @returns The formatted time string. */ private formatTime; static ɵfac: i0.ɵɵFactoryDeclaration<AdjustAggregatedTimeRangePipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<AdjustAggregatedTimeRangePipe, "adjustAggregatedTimeRange", true>; } //# sourceMappingURL=adjust-aggregated-time-range.pipe.d.ts.map