Skip to content

Commit 5c983f7

Browse files
authored
Update timer metrics to show C1-C4 duration (#7)
1 parent fe2a3b5 commit 5c983f7

3 files changed

Lines changed: 24 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.1.16] — 2026-02-23
9+
10+
### Changed
11+
- Updated Timer screen summary metrics: replaced `Magnitude` with `C1-C4 Duration` (computed from first to last contact times) and renamed `Central Duration` to `Totality Duration` for clearer eclipse-phase wording.
12+
- Bumped `apps/mobile` version to `1.1.16`.
13+
814
## [1.1.15] — 2026-02-23
915

1016
### Removed

apps/mobile/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eclipse-timer/mobile",
3-
"version": "1.1.15",
3+
"version": "1.1.16",
44
"private": true,
55
"main": "index.js",
66
"scripts": {

apps/mobile/src/screens/TimerScreen.tsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ function localKindLabel(kind: "none" | "partial" | "total" | "annular") {
3838
return "None";
3939
}
4040

41-
function formatMagnitude(magnitude?: number) {
42-
if (typeof magnitude !== "number" || !Number.isFinite(magnitude)) return "--";
43-
return magnitude.toFixed(3);
44-
}
45-
4641
function formatDuration(seconds?: number) {
4742
if (typeof seconds !== "number" || !Number.isFinite(seconds) || seconds <= 0) return "--";
4843
const totalSeconds = Math.round(seconds);
@@ -51,6 +46,20 @@ function formatDuration(seconds?: number) {
5146
return `${mm}m ${String(ss).padStart(2, "0")}s`;
5247
}
5348

49+
function parseUtcTimestamp(iso?: string) {
50+
if (!iso) return undefined;
51+
const timestamp = Date.parse(iso);
52+
if (!Number.isFinite(timestamp)) return undefined;
53+
return timestamp;
54+
}
55+
56+
function formatC1ToC4Duration(result: Circumstances) {
57+
const c1 = parseUtcTimestamp(result.c1Utc);
58+
const c4 = parseUtcTimestamp(result.c4Utc);
59+
if (c1 === undefined || c4 === undefined || c4 <= c1) return "--";
60+
return formatDuration((c4 - c1) / 1000);
61+
}
62+
5463
function formatCardinalCoord(
5564
value: number,
5665
positiveHemisphere: string,
@@ -742,11 +751,11 @@ export default function TimerScreen({
742751
</Text>
743752
</View>
744753
<View style={styles.metricTile}>
745-
<Text style={styles.metricLabel}>Magnitude</Text>
746-
<Text style={styles.metricValue}>{formatMagnitude(timer.result.magnitude)}</Text>
754+
<Text style={styles.metricLabel}>C1-C4 Duration</Text>
755+
<Text style={styles.metricValue}>{formatC1ToC4Duration(timer.result)}</Text>
747756
</View>
748757
<View style={styles.metricTile}>
749-
<Text style={styles.metricLabel}>Central Duration</Text>
758+
<Text style={styles.metricLabel}>Totality Duration</Text>
750759
<Text style={styles.metricValue}>
751760
{formatDuration(timer.result.durationSeconds)}
752761
</Text>

0 commit comments

Comments
 (0)