• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

atinc / ngx-tethys / 68ef226c-f83e-44c1-b8ed-e420a83c5d84

28 May 2025 10:31AM UTC coverage: 10.352% (-80.0%) from 90.316%
68ef226c-f83e-44c1-b8ed-e420a83c5d84

Pull #3460

circleci

pubuzhixing8
chore: xxx
Pull Request #3460: refactor(icon): migrate signal input #TINFR-1476

132 of 6823 branches covered (1.93%)

Branch coverage included in aggregate %.

10 of 14 new or added lines in 1 file covered. (71.43%)

11648 existing lines in 344 files now uncovered.

2078 of 14525 relevant lines covered (14.31%)

6.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

15.87
/src/date-picker/picker.pipes.ts
1
import { Pipe, PipeTransform, inject } from '@angular/core';
2
import { ThyI18nService } from 'ngx-tethys/i18n';
3
import { TinyDate } from 'ngx-tethys/util';
4
import { DateHelperService } from './date-helper.service';
5
import { ThyDatePickerConfigService } from './date-picker.service';
6
import { AdvancedSelectableCell } from './inner-types';
7
import { getFlexibleAdvancedReadableValue, transformDateValue } from './picker.util';
8
import { CompatibleDate, DateEntry, ThyDateGranularity, ThyDateRangeEntry } from './standard-types';
9

10
/**
11
 * @private
1✔
12
 */
UNCOV
13
@Pipe({
×
UNCOV
14
    name: 'thyDatePickerFormat'
×
UNCOV
15
})
×
16
export class ThyDatePickerFormatPipe implements PipeTransform {
17
    private dateHelper = inject(DateHelperService);
UNCOV
18
    private datePickerConfigService = inject(ThyDatePickerConfigService);
×
UNCOV
19
    private i18n = inject(ThyI18nService);
×
UNCOV
20

×
21
    transform(originalValue: CompatibleDate | DateEntry | ThyDateRangeEntry, formatStr?: string, separator?: string): string {
UNCOV
22
        const { value, withTime, flexibleDateGranularity } = transformDateValue(originalValue);
×
UNCOV
23

×
UNCOV
24
        if (!formatStr) {
×
25
            formatStr = withTime ? 'yyyy-MM-dd HH:mm' : 'yyyy-MM-dd';
26
        }
27
        const currentSeparator = ` ${(separator ?? this.datePickerConfigService.separator)?.trim()} `;
×
28
        if (!Array.isArray(value)) {
×
29
            return this.dateHelper.format(value, formatStr);
×
30
        } else {
31
            if (flexibleDateGranularity && flexibleDateGranularity !== 'day') {
32
                const tinyDates = [new TinyDate(value[0]), new TinyDate(value[1])];
×
33
                return getFlexibleAdvancedReadableValue(tinyDates, flexibleDateGranularity, currentSeparator, this.i18n.getLocale());
34
            } else {
35
                return value.map(date => this.dateHelper.format(date, formatStr)).join(currentSeparator);
36
            }
37
        }
1✔
38
    }
39
}
40

41
@Pipe({
42
    name: 'thyQuarterPickerFormat'
43
})
1✔
44
export class ThyQuarterPickerFormatPipe implements PipeTransform {
UNCOV
45
    constructor(private datePickerConfigService: ThyDatePickerConfigService) {}
×
46

47
    transform(originalValue: CompatibleDate | DateEntry | ThyDateRangeEntry, formatStr?: string, separator?: string): string {
UNCOV
48
        const { value, withTime } = transformDateValue(originalValue);
×
UNCOV
49

×
UNCOV
50
        if (!formatStr) {
×
51
            formatStr = 'yyyy-qqq';
UNCOV
52
        }
×
53

×
54
        if (!value) {
UNCOV
55
            return;
×
UNCOV
56
        }
×
UNCOV
57

×
58
        if (!Array.isArray(value)) {
59
            const _value = new TinyDate(value);
UNCOV
60
            return _value.format(formatStr);
×
61
        } else {
UNCOV
62
            return value
×
UNCOV
63
                .map(date => {
×
64
                    const _date = new TinyDate(date);
65
                    return _date.format(formatStr);
×
66
                })
67
                .join(` ${(separator ?? this.datePickerConfigService.separator)?.trim()} `);
68
        }
1✔
69
    }
70
}
71

72
/**
1✔
73
 * @private
74
 */
75
@Pipe({
76
    name: 'thyDatePickerFormatString'
77
})
78
export class ThyDatePickerFormatStringPipe implements PipeTransform {
79
    private dateHelper = inject(DateHelperService);
80

81
    transform(originalValue: CompatibleDate | DateEntry | ThyDateRangeEntry): string {
82
        const { withTime } = transformDateValue(originalValue);
1✔
83

84
        return withTime ? 'yyyy-MM-dd HH:mm' : 'yyyy-MM-dd';
×
85
    }
86
}
87

×
88
/**
×
89
 * @private
90
 */
91
@Pipe({
1✔
92
    name: 'showYearTip'
93
})
94
export class DatePickerAdvancedShowYearTipPipe implements PipeTransform {
95
    constructor() {}
96
    transform(value: AdvancedSelectableCell, type: ThyDateGranularity): boolean {
97
        return type !== 'year' && value.startValue.isSameDay(value.startValue.startOfYear());
98
    }
99
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc