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

pglejzer / timepicker-ui / 21549389137

31 Jan 2026 07:04PM UTC coverage: 80.798%. First build
21549389137

Pull #110

github

web-flow
Merge 3b433de49 into fcb4cf379
Pull Request #110: Upgrade/new options

2137 of 2953 branches covered (72.37%)

Branch coverage included in aggregate %.

753 of 823 new or added lines in 33 files covered. (91.49%)

2807 of 3166 relevant lines covered (88.66%)

32.08 hits per line

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

90.63
/app/src/managers/clock/engine/ClockEngine.ts
1
import type { EngineInput, EngineOutput } from '../types';
2
import { AngleEngine } from './AngleEngine';
8✔
3
import { HourEngine } from './HourEngine';
8✔
4
import { MinuteEngine } from './MinuteEngine';
8✔
5

8✔
6
export class ClockEngine {
8✔
7
  static processPointerInput(input: EngineInput): EngineOutput {
8
    const rawAngle = AngleEngine.calculateRawAngle(input.pointerPosition, input.clockCenter);
9

13✔
10
    if (input.mode === 'hours') {
13✔
11
      return this.processHours(rawAngle, input);
7✔
12
    } else {
13
      return this.processMinutes(rawAngle, input);
14
    }
6✔
15
  }
16

17
  private static processHours(rawAngle: number, input: EngineInput): EngineOutput {
18
    const smoothSnap = input.smoothHourSnap ?? true;
19

7!
20
    let workingAngle: number;
21
    if (smoothSnap) {
7!
NEW
22
      workingAngle = rawAngle;
×
23
    } else {
24
      const increment = input.incrementHours * 30;
25
      workingAngle = AngleEngine.snapToIncrement(rawAngle, increment);
7✔
26
    }
7✔
27

28
    const distance = AngleEngine.calculateDistance(input.pointerPosition, input.clockCenter);
7✔
29
    const isInner = input.clockType === '24h' && AngleEngine.isInnerCircle(distance, input.clockRadius);
7✔
30

7✔
31
    let index = HourEngine.angleToIndex(workingAngle, input.clockType, isInner);
7✔
32
    const value = HourEngine.indexToValue(index, input.clockType, input.amPm);
7✔
33

7✔
34
    const isDisabled = HourEngine.isDisabled(value, input.amPm, input.disabledTime);
1✔
35

36
    if (isDisabled) {
7✔
37
      index = HourEngine.findNearestValid(index, input.clockType, input.amPm, input.disabledTime, isInner);
38
    }
7!
39

×
40
    const finalValue = HourEngine.indexToValue(index, input.clockType, input.amPm);
41

42
    let finalAngle: number;
7✔
43
    if (smoothSnap) {
44
      finalAngle = rawAngle;
7✔
45
    } else {
46
      finalAngle = HourEngine.indexToAngle(index, input.clockType);
47
    }
48

49
    return {
7✔
50
      angle: finalAngle,
51
      value: finalValue,
52
      index,
53
      isValid: !isDisabled,
6✔
54
      isInnerCircle: input.clockType === '24h' ? isInner : undefined,
6✔
55
    };
6✔
56
  }
6✔
57

6!
58
  private static processMinutes(rawAngle: number, input: EngineInput): EngineOutput {
6✔
59
    const increment = input.incrementMinutes * 6;
6✔
60
    const snappedAngle = AngleEngine.snapToIncrement(rawAngle, increment);
1✔
61

62
    let index = MinuteEngine.angleToIndex(snappedAngle);
6✔
63
    const value = MinuteEngine.indexToValue(index);
6✔
64

6✔
65
    const currentHour = input.currentHour || '00';
66

67
    const isDisabled = MinuteEngine.isDisabled(
68
      value,
69
      currentHour,
70
      input.amPm,
71
      input.disabledTime,
72
      input.clockType,
19✔
73
    );
19✔
74

11✔
75
    if (isDisabled) {
76
      index = MinuteEngine.findNearestValid(
77
        index,
8✔
78
        currentHour,
79
        input.amPm,
80
        input.disabledTime,
81
        input.clockType,
8✔
82
      );
83
    }
84

85
    const finalValue = MinuteEngine.indexToValue(index);
86
    const finalAngle = MinuteEngine.indexToAngle(index);
87

88
    return {
89
      angle: finalAngle,
90
      value: finalValue,
91
      index,
92
      isValid: !isDisabled,
93
    };
94
  }
95

96
  static valueToAngle(value: string, mode: 'hours' | 'minutes', clockType: '12h' | '24h'): number {
97
    const numValue = parseInt(value, 10);
98

99
    if (mode === 'hours') {
100
      return HourEngine.indexToAngle(numValue, clockType);
101
    } else {
102
      return MinuteEngine.indexToAngle(numValue);
103
    }
104
  }
105
}
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

© 2026 Coveralls, Inc