Skip to content

Commit

Permalink
fix(protocol-designer): fix time format in load file (#17053)
Browse files Browse the repository at this point in the history
* fix(protocol-designer): fix time format in load file
  • Loading branch information
koji authored Dec 6, 2024
1 parent eb163e4 commit fd2bab7
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"pauseAction": "untilTime",
"pauseMessage": "",
"pauseTemperature": null,
"pauseTime": "0:1:2",
"pauseTime": "00:01:02",
"id": "5db07ad0-75c7-11ea-b42f-4b64e50f43e5",
"stepType": "pause",
"stepName": "pause",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
"pauseAction": "untilTime",
"pauseMessage": "",
"pauseTemperature": null,
"pauseTime": "0:1:2",
"pauseTime": "00:01:02",
"id": "5db07ad0-75c7-11ea-b42f-4b64e50f43e5",
"stepType": "pause",
"stepName": "pause",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
"pauseAction": "untilTime",
"pauseMessage": "",
"pauseTemperature": null,
"pauseTime": "0:1:0",
"pauseTime": "00:01:00",
"id": "e3989707-210d-457f-a9bb-a85b3ef9b59c",
"stepType": "pause",
"stepName": "pause",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
"pauseAction": "untilTime",
"pauseMessage": "Delay plz",
"pauseTemperature": null,
"pauseTime": "1:2:3",
"pauseTime": "01:02:03",
"id": "2e622080-92a6-11e9-ac62-1b173f839d9e",
"stepType": "pause",
"stepName": "pause",
Expand Down
7 changes: 5 additions & 2 deletions protocol-designer/src/load-file/migration/8_2_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ const getTimeFromIndividualUnits = (
minutes: any,
hours?: any
): string => {
const hoursString = hours !== undefined ? `${hours ?? 0}:` : ''
return `${hoursString}${minutes ?? 0}:${seconds ?? 0}`
const pad = (num: number): string => String(num).padStart(2, '0')
const hoursString = hours !== undefined ? `${pad(Number(hours) ?? 0)}:` : ''
return `${hoursString}${pad(Number(minutes) ?? 0)}:${pad(
Number(seconds) ?? 0
)}`
}

export const migrateFile = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('pauseFormToArgs', () => {
pauseAction: PAUSE_UNTIL_TIME,
description: 'some description',
pauseMessage: 'some message',
pauseTime: '1:20:5',
pauseTime: '01:20:05',
}
const expected = {
commandCreatorFnName: 'delay',
Expand Down

0 comments on commit fd2bab7

Please sign in to comment.