@zinn-dev/cli 0.37.0 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,490 @@
1
+ import type { Activity, ActivityAction, ActivityTaskIdentity } from "@zinn-dev/core";
2
+
3
+ import {
4
+ activity,
5
+ activityTaskKeySchema,
6
+ column,
7
+ label,
8
+ minimumActivityIdLength,
9
+ project,
10
+ task,
11
+ } from "@zinn-dev/core";
12
+ import { formatDescriptionPreview } from "./description-presentation";
13
+ import { formatRows } from "./row-layout";
14
+ import { formatSection } from "./section";
15
+ import { formatLocalTime } from "./time";
16
+
17
+ type NavigationIdentity = {
18
+ /** Undefined when the entity no longer exists and this event recorded no name for it. */
19
+ name?: string;
20
+ status: "current" | "archived" | "deleted";
21
+ distinguishesTaskId?: boolean;
22
+ };
23
+
24
+ export type PresentedActivity = {
25
+ event: Activity;
26
+ displayId: string;
27
+ navigation: NavigationIdentity;
28
+ removedTasks: Array<ActivityTaskIdentity>;
29
+ };
30
+
31
+ const RECORDED_FIELDS = new Set([
32
+ "id",
33
+ "key",
34
+ "name",
35
+ "title",
36
+ "description",
37
+ "priority",
38
+ "color",
39
+ "column",
40
+ "columns",
41
+ "project",
42
+ "tasks",
43
+ "labels",
44
+ "added",
45
+ "removed",
46
+ "type",
47
+ "source",
48
+ "target",
49
+ "comment",
50
+ "text",
51
+ ]);
52
+
53
+ const ENTITY_PREVIEW_LENGTH = 24;
54
+ const ACTION_LABELS: Record<ActivityAction, string> = {
55
+ create: "created",
56
+ edit: "edited",
57
+ move: "moved",
58
+ order: "reordered",
59
+ archive: "archived",
60
+ unarchive: "unarchived",
61
+ delete: "deleted",
62
+ relation_create: "added relation",
63
+ relation_delete: "removed relation",
64
+ comment_create: "added comment",
65
+ comment_edit: "edited comment",
66
+ comment_delete: "deleted comment",
67
+ };
68
+
69
+ function isRecord(value: unknown): value is Record<string, unknown> {
70
+ return value != null && typeof value === "object" && !Array.isArray(value);
71
+ }
72
+
73
+ function commonPrefixLength(left: string, right: string) {
74
+ let length = 0;
75
+ while (length < left.length && length < right.length && left[length] === right[length]) {
76
+ length++;
77
+ }
78
+
79
+ return length;
80
+ }
81
+
82
+ function canonicalPrefix(id: string, hexLength: number) {
83
+ let digits = 0;
84
+
85
+ for (let index = 0; index < id.length; index++) {
86
+ if (id[index] !== "-") {
87
+ digits++;
88
+ }
89
+ if (digits === hexLength) {
90
+ return id.slice(0, index + 1);
91
+ }
92
+ }
93
+ return id;
94
+ }
95
+
96
+ /** Neighbors in sorted UUID order determine the shortest globally unique left prefix. */
97
+ export function abbreviateActivityIds(ids: Array<string>) {
98
+ const sorted = ids
99
+ .map((id) => ({ id, hex: id.replaceAll("-", "").toLowerCase() }))
100
+ .sort((left, right) => left.hex.localeCompare(right.hex));
101
+ const prefixes = new Map<string, string>();
102
+
103
+ for (const [index, entry] of sorted.entries()) {
104
+ const previous = sorted[index - 1]?.hex ?? "";
105
+ const next = sorted[index + 1]?.hex ?? "";
106
+ const length = Math.max(
107
+ minimumActivityIdLength,
108
+ commonPrefixLength(entry.hex, previous) + 1,
109
+ commonPrefixLength(entry.hex, next) + 1,
110
+ );
111
+ prefixes.set(entry.id, canonicalPrefix(entry.id, length));
112
+ }
113
+
114
+ return prefixes;
115
+ }
116
+
117
+ function getTaskNavigation(events: Array<Activity>, taskKey?: string) {
118
+ if (taskKey !== undefined) {
119
+ return activity.getTaskIdentities(taskKey);
120
+ }
121
+
122
+ const identities = new Map<string, ActivityTaskIdentity>();
123
+ if (events.some((event) => event.entity_type === "task")) {
124
+ for (const item of task.getAll({ archive: "all" })) {
125
+ identities.set(item.id, {
126
+ id: item.id,
127
+ key: item.key,
128
+ title: item.title,
129
+ status: item.archived_at == null ? "active" : "archived",
130
+ });
131
+ }
132
+ }
133
+
134
+ const historicalKeys = new Set<string>();
135
+ function addKey(key: unknown) {
136
+ const parsed = activityTaskKeySchema.safeParse(key);
137
+ if (parsed.success) {
138
+ historicalKeys.add(parsed.data);
139
+ }
140
+ }
141
+
142
+ for (const event of events) {
143
+ if (event.action !== "delete") {
144
+ continue;
145
+ }
146
+
147
+ if (event.entity_type === "task") {
148
+ addKey(event.changes?.key);
149
+ } else if (event.entity_type === "project" && Array.isArray(event.changes?.tasks)) {
150
+ for (const snapshot of event.changes.tasks) {
151
+ if (isRecord(snapshot)) {
152
+ addKey(snapshot.key);
153
+ }
154
+ }
155
+ }
156
+ }
157
+ for (const key of historicalKeys) {
158
+ for (const identity of activity.getTaskIdentities(key)) {
159
+ identities.set(identity.id, identity);
160
+ }
161
+ }
162
+
163
+ return [...identities.values()];
164
+ }
165
+
166
+ export function presentActivities(
167
+ events: Array<Activity>,
168
+ options: { taskKey?: string; showsFullIds?: boolean } = {},
169
+ ): Array<PresentedActivity> {
170
+ if (events.length === 0) {
171
+ return [];
172
+ }
173
+
174
+ const prefixes = options.showsFullIds
175
+ ? new Map<string, string>()
176
+ : abbreviateActivityIds(activity.getIds());
177
+ const tasks = getTaskNavigation(events, options.taskKey);
178
+ const tasksById = new Map(tasks.map((identity) => [identity.id, identity]));
179
+ const taskIdsByKey = new Map<string, number>();
180
+
181
+ for (const identity of tasks) {
182
+ taskIdsByKey.set(identity.key, (taskIdsByKey.get(identity.key) ?? 0) + 1);
183
+ }
184
+
185
+ const projectsById = new Map(project.getAll().map((item) => [item.id, item]));
186
+ const labelsById = events.some((event) => event.entity_type === "label")
187
+ ? new Map(label.getAll().map((item) => [item.id, item]))
188
+ : new Map();
189
+ const navigationByEntity = new Map<string, NavigationIdentity | undefined>();
190
+
191
+ return events.map((event) => {
192
+ const entityKey = `${event.entity_type}:${event.entity_id}`;
193
+ let navigation = navigationByEntity.get(entityKey);
194
+
195
+ if (!navigationByEntity.has(entityKey)) {
196
+ switch (event.entity_type) {
197
+ case "task": {
198
+ const identity = tasksById.get(event.entity_id);
199
+ if (identity !== undefined) {
200
+ navigation = {
201
+ name: identity.key,
202
+ status: identity.status === "active" ? "current" : identity.status,
203
+ distinguishesTaskId: taskIdsByKey.get(identity.key)! > 1,
204
+ };
205
+ }
206
+ break;
207
+ }
208
+ case "project": {
209
+ const current = projectsById.get(event.entity_id);
210
+ if (current !== undefined) {
211
+ navigation = { name: current.key, status: "current" };
212
+ }
213
+ break;
214
+ }
215
+ case "column": {
216
+ const current = column.getById(event.entity_id);
217
+ if (current != null) {
218
+ navigation = { name: current.name, status: "current" };
219
+ }
220
+ break;
221
+ }
222
+ case "label": {
223
+ const current = labelsById.get(event.entity_id);
224
+ if (current !== undefined) {
225
+ navigation = { name: current.name, status: "current" };
226
+ }
227
+ break;
228
+ }
229
+ }
230
+ navigationByEntity.set(entityKey, navigation);
231
+ }
232
+ const isSnapshot = event.action === "create" || event.action === "delete";
233
+ const recordedName = event.changes?.key ?? event.changes?.name;
234
+
235
+ // Every existing entity was found above, so it means that a missing one has been *deleted*.
236
+ if (navigation === undefined) {
237
+ navigation = {
238
+ name: isSnapshot && typeof recordedName === "string" ? recordedName : undefined,
239
+ status: "deleted",
240
+ };
241
+ }
242
+
243
+ const isProjectDeletion = event.entity_type === "project" && event.action === "delete";
244
+ const removedTaskIds =
245
+ isProjectDeletion && Array.isArray(event.changes?.tasks)
246
+ ? new Set(event.changes.tasks.filter(isRecord).map((snapshot) => snapshot.id))
247
+ : new Set();
248
+
249
+ return {
250
+ event,
251
+ displayId: options.showsFullIds ? event.id : prefixes.get(event.id)!,
252
+ navigation,
253
+ removedTasks:
254
+ options.taskKey === undefined
255
+ ? []
256
+ : tasks.filter((identity) => removedTaskIds.has(identity.id)),
257
+ };
258
+ });
259
+ }
260
+
261
+ function formatNavigation(entry: PresentedActivity, options: { showsFullNames?: boolean } = {}) {
262
+ const { event, navigation } = entry;
263
+ const identity = navigation.distinguishesTaskId ? `; ${event.entity_id}` : "";
264
+ const name =
265
+ navigation.name === undefined
266
+ ? event.entity_id
267
+ : options.showsFullNames
268
+ ? navigation.name
269
+ : formatDescriptionPreview(navigation.name);
270
+ return `${event.entity_type} ${name} [${navigation.status}${identity}]`;
271
+ }
272
+
273
+ function summarizeValue(value: unknown): string {
274
+ if (typeof value === "string") {
275
+ return value;
276
+ }
277
+
278
+ if (isRecord(value)) {
279
+ const name = value.key ?? value.name ?? value.title ?? value.id;
280
+ if (typeof name === "string") {
281
+ return name;
282
+ }
283
+ }
284
+
285
+ return JSON.stringify(value);
286
+ }
287
+
288
+ function isRecordedChangePair(event: Activity, value: unknown): value is [unknown, unknown] {
289
+ return (
290
+ ["edit", "move", "comment_edit"].includes(event.action) &&
291
+ Array.isArray(value) &&
292
+ value.length === 2
293
+ );
294
+ }
295
+
296
+ function formatRemovedTasks(entry: PresentedActivity) {
297
+ return entry.removedTasks.map((identity) => `removed ${identity.key} (${identity.id})`);
298
+ }
299
+
300
+ function formatChangeSummary(
301
+ entry: PresentedActivity,
302
+ options: { showsRemovedTasks?: boolean; omitsIdentity?: boolean } = {},
303
+ ) {
304
+ const { event } = entry;
305
+ const changes = event.changes;
306
+ let summary = "-";
307
+
308
+ if (changes !== null) {
309
+ summary =
310
+ Object.entries(changes)
311
+ .map(([field, value]) => {
312
+ const isSnapshot = event.action === "create" || event.action === "delete";
313
+ if (isSnapshot && value === null) {
314
+ return null;
315
+ }
316
+ const repeatsIdentity =
317
+ options.omitsIdentity &&
318
+ isSnapshot &&
319
+ (field === "key" || field === "name") &&
320
+ value === entry.navigation.name;
321
+ if (repeatsIdentity) {
322
+ return null;
323
+ }
324
+ if (!RECORDED_FIELDS.has(field)) {
325
+ return `${field}: ${JSON.stringify(value)}`;
326
+ }
327
+ if (field === "description") {
328
+ return event.action === "edit" ? "description changed" : "description recorded";
329
+ }
330
+ if (field === "title" && options.omitsIdentity && isSnapshot) {
331
+ return summarizeValue(value);
332
+ }
333
+ if (isRecordedChangePair(event, value)) {
334
+ return `${field}: ${summarizeValue(value[0])} → ${summarizeValue(value[1])}`;
335
+ }
336
+ if (Array.isArray(value)) {
337
+ if (field === "labels" && value.length === 0) {
338
+ return null;
339
+ }
340
+ return `${field}: ${value.length}`;
341
+ }
342
+ if (field === "labels" && isRecord(value)) {
343
+ const additions =
344
+ Array.isArray(value.added) && value.added.length > 0
345
+ ? `added labels ${value.added.map(summarizeValue).join(", ")}`
346
+ : "";
347
+ const removals =
348
+ Array.isArray(value.removed) && value.removed.length > 0
349
+ ? `removed labels ${value.removed.map(summarizeValue).join(", ")}`
350
+ : "";
351
+ return (
352
+ [additions, removals].filter((part) => part.length > 0).join("; ") ||
353
+ `labels: ${JSON.stringify(value)}`
354
+ );
355
+ }
356
+ if (field === "comment" && isRecord(value)) {
357
+ return `comment ${summarizeValue(value)}${typeof value.text === "string" ? `: ${value.text}` : ""}`;
358
+ }
359
+ return `${field}: ${summarizeValue(value)}`;
360
+ })
361
+ .filter((part) => part !== null)
362
+ .join("; ") || "-";
363
+ }
364
+ const removed = options.showsRemovedTasks === false ? "" : formatRemovedTasks(entry).join("; ");
365
+ return [formatDescriptionPreview(summary), removed].filter((part) => part.length > 0).join("; ");
366
+ }
367
+
368
+ function formatActivityContent(entry: PresentedActivity) {
369
+ const { event, navigation } = entry;
370
+ const name = navigation.name ?? event.entity_id;
371
+ const shortName = formatDescriptionPreview(name, { maxLength: ENTITY_PREVIEW_LENGTH });
372
+ const entityType =
373
+ event.entity_type === "task" && navigation.name !== undefined ? "" : `${event.entity_type} `;
374
+ const isMutableCurrentName =
375
+ navigation.status === "current" &&
376
+ (event.entity_type === "label" || event.entity_type === "column");
377
+ const marker =
378
+ navigation.status === "deleted" ? " [deleted]" : isMutableCurrentName ? " [current name]" : "";
379
+ const action = ACTION_LABELS[event.action] ?? event.action;
380
+ const summary = formatChangeSummary(entry, { showsRemovedTasks: false, omitsIdentity: true });
381
+ const lines = [
382
+ `${entityType}${shortName}${marker} · ${action}${summary === "-" ? "" : `: ${summary}`}`,
383
+ ];
384
+
385
+ if (shortName !== name) {
386
+ const nameLabel =
387
+ navigation.name === undefined
388
+ ? "Entity ID"
389
+ : event.entity_type === "task" || event.entity_type === "project"
390
+ ? `Full ${event.entity_type} key`
391
+ : `Full ${event.entity_type} name`;
392
+ lines.push(`${nameLabel}: ${name}`);
393
+ }
394
+ if (navigation.distinguishesTaskId) {
395
+ lines.push(`Task ID: ${event.entity_id}`);
396
+ }
397
+ lines.push(...formatRemovedTasks(entry));
398
+ return lines.join("\n");
399
+ }
400
+
401
+ function formatRecordedValue(value: unknown): string {
402
+ if (typeof value === "string") {
403
+ return value;
404
+ }
405
+ if (Array.isArray(value)) {
406
+ if (value.length === 0) {
407
+ return "[]";
408
+ }
409
+ return value
410
+ .map((item, index) => formatSection(`Item ${index + 1}`, formatRecordedValue(item)))
411
+ .join("\n\n");
412
+ }
413
+ if (isRecord(value)) {
414
+ return (
415
+ Object.entries(value)
416
+ .map(([field, item]) =>
417
+ formatSection(
418
+ field,
419
+ RECORDED_FIELDS.has(field) ? formatRecordedValue(item) : JSON.stringify(item, null, 2),
420
+ ),
421
+ )
422
+ .join("\n\n") || "{}"
423
+ );
424
+ }
425
+ return JSON.stringify(value);
426
+ }
427
+
428
+ function formatRecordedChanges(event: Activity) {
429
+ if (event.changes === null) {
430
+ return "null";
431
+ }
432
+
433
+ const sections: Array<string> = [];
434
+ const unknownFields: Record<string, unknown> = {};
435
+ for (const [field, value] of Object.entries(event.changes)) {
436
+ if (!RECORDED_FIELDS.has(field)) {
437
+ unknownFields[field] = value;
438
+ continue;
439
+ }
440
+ const body = isRecordedChangePair(event, value)
441
+ ? `${formatSection("From", formatRecordedValue(value[0]))}\n\n${formatSection("To", formatRecordedValue(value[1]))}`
442
+ : formatRecordedValue(value);
443
+ sections.push(formatSection(field, body));
444
+ }
445
+ if (Object.keys(unknownFields).length > 0) {
446
+ sections.push(formatSection("Raw JSON", JSON.stringify(unknownFields, null, 2)));
447
+ }
448
+ return sections.join("\n\n") || "{}";
449
+ }
450
+
451
+ export function formatActivityList(
452
+ entries: Array<PresentedActivity>,
453
+ options: { showsDetails?: boolean } = {},
454
+ ) {
455
+ const rows = entries.map((entry) => {
456
+ const metadata = [
457
+ { text: entry.displayId },
458
+ { text: formatLocalTime(entry.event.created_at), style: "dim" as const },
459
+ { text: `${entry.event.actor_name} (${entry.event.actor_kind})` },
460
+ ];
461
+ if (!options.showsDetails) {
462
+ return [...metadata, { text: formatActivityContent(entry) }];
463
+ }
464
+ return [
465
+ ...metadata,
466
+ { text: formatNavigation(entry, { showsFullNames: true }) },
467
+ { text: entry.event.action },
468
+ { text: formatChangeSummary(entry) },
469
+ ];
470
+ });
471
+ if (!options.showsDetails) {
472
+ return formatRows(rows, { indentsContinuationLines: true });
473
+ }
474
+ return entries
475
+ .map((entry, index) =>
476
+ [
477
+ formatRows([rows[index]!]),
478
+ formatSection("Entity", `${entry.event.entity_type} ${entry.event.entity_id}`),
479
+ ...(entry.navigation.name === undefined
480
+ ? []
481
+ : [formatSection("Navigation", formatNavigation(entry, { showsFullNames: true }))]),
482
+ formatSection(
483
+ "Actor",
484
+ `${entry.event.actor_name}\nKind: ${entry.event.actor_kind}\nEmail: ${entry.event.actor_email ?? "null"}`,
485
+ ),
486
+ formatSection("Changes", formatRecordedChanges(entry.event)),
487
+ ].join("\n\n"),
488
+ )
489
+ .join("\n\n");
490
+ }
@@ -2,7 +2,8 @@ import type { RowCell } from "./row-layout";
2
2
 
3
3
  import { formatRows } from "./row-layout";
4
4
 
5
- export type PresentedColumnTaskCount = { name: string; taskCount: number };
5
+ export type PresentedColumn = { name: string; project?: string; taskCount?: number };
6
+ export type PresentedColumnTaskCount = PresentedColumn & { taskCount: number };
6
7
 
7
8
  /** Archived tasks are off the board, so they share one row below the columns instead of a column of their own. */
8
9
  const ARCHIVED_ROW_LABEL = "Archived";
@@ -21,16 +22,25 @@ export function columnNameCell(columnName: string): RowCell {
21
22
  }
22
23
 
23
24
  /** The archived row is left out when there are no archived tasks. */
24
- export function formatColumnTaskCounts(
25
- presentedColumns: Array<PresentedColumnTaskCount>,
26
- options: { archivedTaskCount: number },
25
+ export function formatColumnList(
26
+ presentedColumns: Array<PresentedColumn>,
27
+ options: { showsProject?: boolean; showsTaskCounts?: boolean; archivedTaskCount?: number } = {},
27
28
  ) {
28
- const rows: Array<Array<RowCell>> = presentedColumns.map((presentedColumn) => [
29
- columnNameCell(presentedColumn.name),
30
- { text: String(presentedColumn.taskCount) },
31
- ]);
29
+ const rows: Array<Array<RowCell>> = presentedColumns.map((presentedColumn) => {
30
+ const projectCells: Array<RowCell> =
31
+ options.showsProject && presentedColumn.project != null
32
+ ? [{ text: presentedColumn.project }]
33
+ : [];
32
34
 
33
- if (options.archivedTaskCount > 0) {
35
+ const taskCountCells: Array<RowCell> =
36
+ options.showsTaskCounts && presentedColumn.taskCount != null
37
+ ? [{ text: String(presentedColumn.taskCount) }]
38
+ : [];
39
+
40
+ return [...projectCells, columnNameCell(presentedColumn.name), ...taskCountCells];
41
+ });
42
+
43
+ if (options.archivedTaskCount != null && options.archivedTaskCount > 0) {
34
44
  rows.push([{ text: ARCHIVED_ROW_LABEL }, { text: String(options.archivedTaskCount) }]);
35
45
  }
36
46
 
@@ -1,5 +1,8 @@
1
- export function formatDescriptionPreview(description: string | null) {
2
- const DESCRIPTION_PREVIEW_LENGTH = 80;
1
+ export function formatDescriptionPreview(
2
+ description: string | null,
3
+ options: { maxLength?: number } = {},
4
+ ) {
5
+ const previewLength = options.maxLength ?? 80;
3
6
 
4
7
  if (description == null) {
5
8
  return "";
@@ -7,9 +10,9 @@ export function formatDescriptionPreview(description: string | null) {
7
10
 
8
11
  const normalizedDescription = description.replace(/\s+/g, " ").trim();
9
12
 
10
- if (normalizedDescription.length <= DESCRIPTION_PREVIEW_LENGTH) {
13
+ if (normalizedDescription.length <= previewLength) {
11
14
  return normalizedDescription;
12
15
  }
13
16
 
14
- return `${normalizedDescription.slice(0, DESCRIPTION_PREVIEW_LENGTH - 1).trimEnd()}…`;
17
+ return `${normalizedDescription.slice(0, previewLength - 1).trimEnd()}…`;
15
18
  }
@@ -20,12 +20,13 @@ export type PresentedTask = {
20
20
  const EMPTY_CELL_MARKER = "-";
21
21
  const LABEL_NAME_SEPARATOR = ", ";
22
22
 
23
- function taskPriorityCell(priority: TaskPriority | null): RowCell {
23
+ function taskPriorityCell(priority: TaskPriority | null, showsFullPriority: boolean): RowCell {
24
24
  if (priority == null) {
25
25
  return { text: EMPTY_CELL_MARKER, style: "dim" };
26
26
  }
27
27
 
28
- return { text: priority[0]!.toUpperCase() };
28
+ const priorityInitial = priority[0]!.toUpperCase();
29
+ return { text: showsFullPriority ? `${priorityInitial}${priority.slice(1)}` : priorityInitial };
29
30
  }
30
31
 
31
32
  /**
@@ -60,7 +61,7 @@ export function formatTaskRow(presented: PresentedTask) {
60
61
 
61
62
  export function formatTaskList(
62
63
  presentedTasks: Array<PresentedTask>,
63
- options: { showsStatus?: boolean } = {},
64
+ options: { showsStatus?: boolean; showsFullPriority?: boolean } = {},
64
65
  ) {
65
66
  const labelColorsByName = getLabelColorsByName();
66
67
 
@@ -79,7 +80,7 @@ export function formatTaskList(
79
80
  { text: presentedTask.key },
80
81
  ...statusCells,
81
82
  columnNameCell(presentedTask.column),
82
- taskPriorityCell(presentedTask.priority),
83
+ taskPriorityCell(presentedTask.priority, options.showsFullPriority ?? false),
83
84
  { text: `${presentedTask.title}${labels}` },
84
85
  ];
85
86
  }),
@@ -0,0 +1,17 @@
1
+ const MINUTES_PER_HOUR = 60;
2
+
3
+ export function formatLocalTime(timestamp: number) {
4
+ const date = new Date(timestamp);
5
+ const offsetMinutes = -date.getTimezoneOffset();
6
+ const offsetSign = offsetMinutes >= 0 ? "+" : "-";
7
+ const absoluteOffsetMinutes = Math.abs(offsetMinutes);
8
+ const offsetHours = Math.floor(absoluteOffsetMinutes / MINUTES_PER_HOUR);
9
+ const remainingOffsetMinutes = absoluteOffsetMinutes % MINUTES_PER_HOUR;
10
+ const pad = (value: number) => String(value).padStart(2, "0");
11
+
12
+ return (
13
+ `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ` +
14
+ `${pad(date.getHours())}:${pad(date.getMinutes())} ` +
15
+ `${offsetSign}${pad(offsetHours)}:${pad(remainingOffsetMinutes)}`
16
+ );
17
+ }