diff --git a/libs/barista-components/formatters/README.md b/libs/barista-components/formatters/README.md
index 4a43b3242d..a143c6d666 100644
--- a/libs/barista-components/formatters/README.md
+++ b/libs/barista-components/formatters/README.md
@@ -42,12 +42,6 @@ The `dtRate` pipe provides a way to add a rate info to the value
-### Time (deprecated - Will be removed with version 7.0.0)
-
-The `dtTime` pipe provides a way to format a input time to a timestamp
-
-
-
### Duration
The `dtDuration` pipe provides a way to format an input time to a timestamp
diff --git a/libs/barista-components/formatters/index.ts b/libs/barista-components/formatters/index.ts
index f123021d2a..9e09c40f11 100644
--- a/libs/barista-components/formatters/index.ts
+++ b/libs/barista-components/formatters/index.ts
@@ -14,9 +14,6 @@
* limitations under the License.
*/
-import { DtTime } from './src/time-deprecated/time';
-import { formatTime } from './src/time-deprecated/time-formatter';
-
export * from './src/formatters-module';
export * from './src/unit';
export {
@@ -39,8 +36,4 @@ export * from './src/bits/bits-formatter';
export * from './src/bits/bits';
export * from './src/duration/duration';
export * from './src/duration/duration-formatter';
-export {
- formatTime as experimentalFormatTime,
- DtTime as DtExperimentalFormatTime,
-};
export { DtDateRange, dtFormatDateRange } from './src/date/date-range';
diff --git a/libs/barista-components/formatters/src/formatters-module.ts b/libs/barista-components/formatters/src/formatters-module.ts
index bcc3b598b1..a47c3cb136 100644
--- a/libs/barista-components/formatters/src/formatters-module.ts
+++ b/libs/barista-components/formatters/src/formatters-module.ts
@@ -25,7 +25,6 @@ import { DtCount } from './count/count';
import { DtDateRange } from './date/date-range';
import { DtPercent } from './percent/percent';
import { DtRate } from './rate/rate';
-import { DtTime } from './time-deprecated/time';
import { DtDuration } from './duration/duration';
const FORMATTERS = [
@@ -37,7 +36,6 @@ const FORMATTERS = [
DtPercent,
DtRate,
DtDateRange,
- DtTime,
DtDuration,
];
diff --git a/libs/barista-components/formatters/src/time-deprecated/time-formatter.ts b/libs/barista-components/formatters/src/time-deprecated/time-formatter.ts
deleted file mode 100644
index c95446b05a..0000000000
--- a/libs/barista-components/formatters/src/time-deprecated/time-formatter.ts
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * @license
- * Copyright 2020 Dynatrace LLC
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {
- DtFormattedValue,
- FormattedData,
- NO_DATA,
- SourceData,
-} from '../formatted-value';
-import { DtTimeUnit } from '../unit';
-
-// tslint:disable: no-magic-numbers
-// Factorials needed in converting milliseconds to other time units
-const CONVERSION_FACTORS_TO_MS = new Map([
- [DtTimeUnit.YEAR, 12 * 30.4 * 24 * 60 * 60 * 1000],
- [DtTimeUnit.MONTH, 30.4 * 24 * 60 * 60 * 1000],
- [DtTimeUnit.DAY, 24 * 60 * 60 * 1000],
- [DtTimeUnit.HOUR, 60 * 60 * 1000],
- [DtTimeUnit.MINUTE, 60 * 1000],
- [DtTimeUnit.SECOND, 1000],
- [DtTimeUnit.MILLISECOND, 1],
- [DtTimeUnit.MICROSECOND, 0.001],
- [DtTimeUnit.NANOSECOND, 0.000001],
-]);
-
-const CONVERSIONUNITS = 2;
-
-/** @breaking-change - Will be removed with version 7.0.0 */
-/** @deprecated Please use dtDuration instead */
-/**
- * @param time - numeric time value to be converted to
- * amount of time from years to nanoseconds
- */
-export function formatTime(
- time: number,
- inputUnit: DtTimeUnit = DtTimeUnit.MILLISECOND,
- toUnit: DtTimeUnit | undefined,
-): DtFormattedValue | string {
- const inputData: SourceData = {
- input: time,
- unit: inputUnit,
- };
- let formattedData: FormattedData;
- if (time <= 0) {
- return new DtFormattedValue(
- inputData,
- (formattedData = {
- transformedValue: inputData.input,
- displayValue: '0',
- displayUnit: inputUnit,
- }),
- );
- } else {
- // Calculates the amount of each timeunit and adds the value and unit into a resultstring
- if (CONVERSION_FACTORS_TO_MS.get(inputUnit) === undefined) {
- return NO_DATA;
- }
- const result = buildResultFromTime(time, inputUnit, toUnit);
- if (result === undefined) {
- return NO_DATA;
- }
- let resultString = '';
- result.forEach((value, key) => {
- resultString = `${resultString}${value}${key} `;
- });
- resultString = resultString.trim();
- formattedData = {
- transformedValue: inputData.input,
- displayValue: resultString,
- displayUnit: '',
- };
- return new DtFormattedValue(inputData, formattedData);
- }
-}
-
-// Converts input to milliseconds
-function buildResultFromTime(
- time: number,
- inputUnit: DtTimeUnit,
- toUnit: DtTimeUnit | undefined,
-): Map | undefined {
- if (!CONVERSION_FACTORS_TO_MS.has(inputUnit)) {
- return;
- }
- let rest = time * CONVERSION_FACTORS_TO_MS.get(inputUnit)!;
- const result = new Map();
- let counter = 0;
- let canConvert = false;
- const conversionFactorKeys = Array.from(CONVERSION_FACTORS_TO_MS.keys());
- if (
- toUnit !== undefined &&
- conversionFactorKeys.indexOf(toUnit) >
- conversionFactorKeys.indexOf(inputUnit)
- ) {
- canConvert = true;
- }
- for (const key of conversionFactorKeys) {
- const factor = CONVERSION_FACTORS_TO_MS.get(key)!;
- const amount = Math.trunc(rest / factor);
- if (
- canConvert &&
- conversionFactorKeys.indexOf(toUnit!) >= conversionFactorKeys.indexOf(key)
- ) {
- counter = CONVERSIONUNITS;
- if (amount > 0) {
- result.set(key, amount);
- }
- } else if (counter < CONVERSIONUNITS) {
- if (amount > 0) {
- if (counter < CONVERSIONUNITS) {
- result.set(key, amount);
- }
- counter++;
- // Only next two units will be displayed. Examples: `1y 1mo 1d` instead of `1y 1mo 1d 1h 1min...`
- } else if (counter > 0) {
- counter++;
- }
- }
- rest = rest - amount * factor;
- }
- return result;
-}
diff --git a/libs/barista-components/formatters/src/time-deprecated/time.spec.ts b/libs/barista-components/formatters/src/time-deprecated/time.spec.ts
deleted file mode 100644
index 1b08d15881..0000000000
--- a/libs/barista-components/formatters/src/time-deprecated/time.spec.ts
+++ /dev/null
@@ -1,172 +0,0 @@
-/**
- * @license
- * Copyright 2020 Dynatrace LLC
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// tslint:disable: no-magic-numbers
-import { NO_DATA } from '../formatted-value';
-import { DtTimeUnit } from '../unit';
-import { DtTime } from './time';
-
-describe('DtTimePipe', () => {
- interface TestCase {
- input: number;
- inputFormat: DtTimeUnit | undefined;
- output: string;
- }
-
- interface TestCaseToUnit {
- input: number;
- inputFormat: DtTimeUnit | undefined;
- toUnit: DtTimeUnit;
- output: string;
- }
-
- let pipe: DtTime;
-
- beforeEach(() => {
- pipe = new DtTime();
- });
-
- describe('Transforming input', () => {
- [
- {
- input: 1,
- inputFormat: undefined,
- output: '1ms',
- },
- {
- input: 12 * 30.4 * 24 * 60 * 60 * 1000 + 7,
- inputFormat: undefined,
- output: '1y',
- },
- {
- input: 30.4 * 24 * 60 * 60 * 1000,
- inputFormat: undefined,
- output: '1mo',
- },
- {
- input: 24 * 60 * 60 * 1000,
- inputFormat: undefined,
- output: '1d',
- },
- {
- input: 1.5,
- inputFormat: DtTimeUnit.MONTH,
- output: '1mo 15d',
- },
- {
- input: 1.5,
- inputFormat: DtTimeUnit.HOUR,
- output: '1h 30min',
- },
- {
- input: 1.5,
- inputFormat: DtTimeUnit.MINUTE,
- output: '1min 30s',
- },
- {
- input: 1.5,
- inputFormat: DtTimeUnit.SECOND,
- output: '1s 500ms',
- },
- ].forEach((testCase: TestCase) => {
- it(`should display ${testCase.output} when input is ${testCase.input}`, () => {
- expect(
- pipe
- .transform(testCase.input, testCase.inputFormat, undefined)
- .toString()
- .trim(),
- ).toBe(testCase.output);
- });
- });
- });
- describe('Transforming input with toUnit parameter set', () => {
- [
- {
- input: 1.234567,
- inputFormat: DtTimeUnit.DAY,
- toUnit: DtTimeUnit.SECOND,
- output: '1d 5h 37min 46s',
- },
- {
- input: 1.234567,
- inputFormat: DtTimeUnit.DAY,
- toUnit: DtTimeUnit.HOUR,
- output: '1d 5h',
- },
- {
- input: 1.234567,
- inputFormat: DtTimeUnit.DAY,
- toUnit: DtTimeUnit.MINUTE,
- output: '1d 5h 37min',
- },
- {
- input: 1.234567,
- inputFormat: DtTimeUnit.DAY,
- // should disregard at toUnit set higher than the inputUnit and output three time units
- toUnit: DtTimeUnit.YEAR,
- output: '1d 5h',
- },
- ].forEach((testCaseToUnit: TestCaseToUnit) => {
- it(`should display ${testCaseToUnit.output} when input is ${testCaseToUnit.input} and toUnit is set to ${testCaseToUnit.toUnit}`, () => {
- expect(
- pipe
- .transform(
- testCaseToUnit.input,
- testCaseToUnit.inputFormat,
- testCaseToUnit.toUnit,
- )
- .toString()
- .trim(),
- ).toBe(testCaseToUnit.output);
- });
- });
- });
- describe('Empty Values / Invalid Values', () => {
- it(`should return '${NO_DATA}' for empty values`, () => {
- expect(pipe.transform('', undefined, undefined)).toEqual(NO_DATA);
- expect(pipe.transform(null, undefined, undefined)).toEqual(NO_DATA);
- expect(pipe.transform(undefined, undefined, undefined)).toEqual(NO_DATA);
- });
- it(`should return '${NO_DATA}' for values that cannot be converted to numbers`, () => {
- class A {}
- expect(pipe.transform([], undefined, undefined)).toEqual(NO_DATA);
- expect(pipe.transform({}, undefined, undefined)).toEqual(NO_DATA);
- expect(pipe.transform(() => {}, undefined, undefined)).toEqual(NO_DATA);
- expect(pipe.transform(A, undefined, undefined)).toEqual(NO_DATA);
- expect(pipe.transform(new A(), undefined, undefined)).toEqual(NO_DATA);
- });
- it(`should return '${NO_DATA}' for combined strings`, () => {
- expect(pipe.transform('123test', undefined, undefined)).toEqual(NO_DATA);
- });
- });
- describe('should handle 0 and negative numbers', () => {
- it('should handle 0', () => {
- expect(pipe.transform('0', undefined, undefined).toString()).toEqual(
- '0 ms',
- );
- });
- it('should handle -1', () => {
- expect(pipe.transform('-1', undefined, undefined).toString()).toEqual(
- '0 ms',
- );
- });
- it('should handle -123', () => {
- expect(pipe.transform('-123', undefined, undefined).toString()).toEqual(
- '0 ms',
- );
- });
- });
-});
diff --git a/libs/barista-components/formatters/src/time-deprecated/time.ts b/libs/barista-components/formatters/src/time-deprecated/time.ts
deleted file mode 100644
index ee3b511758..0000000000
--- a/libs/barista-components/formatters/src/time-deprecated/time.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * @license
- * Copyright 2020 Dynatrace LLC
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { coerceNumberProperty } from '@angular/cdk/coercion';
-import { Pipe, PipeTransform } from '@angular/core';
-
-import { isEmpty, isNumber } from '@dynatrace/barista-components/core';
-
-import { DtFormattedValue, NO_DATA } from '../formatted-value';
-import { DtTimeUnit } from '../unit';
-import { formatTime } from './time-formatter';
-
-/** @breaking-change - Will be removed with version 7.0.0 */
-/** @deprecated Please use dtDuration instead */
-/** Pipe used to convert milliseconds to amount of time from years to nanoseconds */
-@Pipe({
- name: 'dtTime',
-})
-export class DtTime implements PipeTransform {
- /**
- * @param input - The timevalue to be formatted to amount of time from years to nanoseconds
- */
- // tslint:disable: no-any
- transform(
- input: any,
- inputUnit: DtTimeUnit = DtTimeUnit.MILLISECOND,
- toUnit: DtTimeUnit | undefined,
- ): DtFormattedValue | string {
- if (isEmpty(input)) {
- return NO_DATA;
- }
- return isNumber(input)
- ? formatTime(coerceNumberProperty(input), inputUnit, toUnit)
- : NO_DATA;
- }
-}
diff --git a/libs/examples/src/formatters/formatters-examples.module.ts b/libs/examples/src/formatters/formatters-examples.module.ts
index bfe2fc4575..7399a693e8 100644
--- a/libs/examples/src/formatters/formatters-examples.module.ts
+++ b/libs/examples/src/formatters/formatters-examples.module.ts
@@ -25,7 +25,6 @@ import { DtExampleFormattersBytes } from './formatters-bytes-example/formatters-
import { DtExampleFormattersCount } from './formatters-count-example/formatters-count-example';
import { DtExampleFormattersPercent } from './formatters-percent-example/formatters-percent-example';
import { DtExampleFormattersRate } from './formatters-rate-example/formatters-rate-example';
-import { DtExampleFormattersTime } from './formatters-time-example/formatters-time-example';
import { DtExampleFormattersDuration } from './formatters-duration-example/formatters-duration-example';
export const DT_FORMATTERS_EXAMPLES = [
@@ -34,7 +33,6 @@ export const DT_FORMATTERS_EXAMPLES = [
DtExampleFormattersCount,
DtExampleFormattersPercent,
DtExampleFormattersRate,
- DtExampleFormattersTime,
DtExampleFormattersDuration,
];
diff --git a/libs/examples/src/formatters/formatters-time-example/formatters-time-example.html b/libs/examples/src/formatters/formatters-time-example/formatters-time-example.html
deleted file mode 100644
index 9dabd7a37a..0000000000
--- a/libs/examples/src/formatters/formatters-time-example/formatters-time-example.html
+++ /dev/null
@@ -1,7 +0,0 @@
-
- Value to be transformed
-
-
-
Ms: {{ exampleValue | dtTime }}
-
Hour: {{ exampleValue | dtTime: 'h' }}
-
Day to Second: {{ exampleValue | dtTime: 'd':'s' }}
diff --git a/libs/examples/src/formatters/formatters-time-example/formatters-time-example.ts b/libs/examples/src/formatters/formatters-time-example/formatters-time-example.ts
deleted file mode 100644
index 8075cef5cd..0000000000
--- a/libs/examples/src/formatters/formatters-time-example/formatters-time-example.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * @license
- * Copyright 2020 Dynatrace LLC
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Component } from '@angular/core';
-
-@Component({
- selector: 'dt-example-formatters-time-example',
- templateUrl: 'formatters-time-example.html',
-})
-export class DtExampleFormattersTime {
- exampleValue: number;
-}
diff --git a/libs/examples/src/formatters/index.ts b/libs/examples/src/formatters/index.ts
index 12f3c6686f..1be28c89eb 100644
--- a/libs/examples/src/formatters/index.ts
+++ b/libs/examples/src/formatters/index.ts
@@ -21,4 +21,3 @@ export * from './formatters-duration-example/formatters-duration-example';
export * from './formatters-examples.module';
export * from './formatters-percent-example/formatters-percent-example';
export * from './formatters-rate-example/formatters-rate-example';
-export * from './formatters-time-example/formatters-time-example';
diff --git a/libs/examples/src/index.ts b/libs/examples/src/index.ts
index 777f00cb8b..22ad8272be 100644
--- a/libs/examples/src/index.ts
+++ b/libs/examples/src/index.ts
@@ -158,7 +158,6 @@ import { DtExampleFormattersCount } from './formatters/formatters-count-example/
import { DtExampleFormattersDuration } from './formatters/formatters-duration-example/formatters-duration-example';
import { DtExampleFormattersPercent } from './formatters/formatters-percent-example/formatters-percent-example';
import { DtExampleFormattersRate } from './formatters/formatters-rate-example/formatters-rate-example';
-import { DtExampleFormattersTime } from './formatters/formatters-time-example/formatters-time-example';
import { DtExampleHighlightCaseSensitive } from './highlight/highlight-case-sensitive-example/highlight-case-sensitive-example';
import { DtExampleHighlightDefault } from './highlight/highlight-default-example/highlight-default-example';
import { DtExampleIconAll } from './icon/icon-all-example/icon-all-example';
@@ -513,7 +512,6 @@ export {
DtExampleFormattersDuration,
DtExampleFormattersPercent,
DtExampleFormattersRate,
- DtExampleFormattersTime,
DtExampleHighlightCaseSensitive,
DtExampleHighlightDefault,
DtExampleIconAll,
@@ -847,7 +845,6 @@ export const EXAMPLES_MAP = new Map>([
['DtExampleFormattersDuration', DtExampleFormattersDuration],
['DtExampleFormattersPercent', DtExampleFormattersPercent],
['DtExampleFormattersRate', DtExampleFormattersRate],
- ['DtExampleFormattersTime', DtExampleFormattersTime],
['DtExampleHighlightCaseSensitive', DtExampleHighlightCaseSensitive],
['DtExampleHighlightDefault', DtExampleHighlightDefault],
['DtExampleIconAll', DtExampleIconAll],