Skip to content

Commit

Permalink
✨ rename: Adjust transcription test file naming convention
Browse files Browse the repository at this point in the history
Renamed test file and improved timestamp precision in functions.
  • Loading branch information
pelikhan committed Feb 22, 2025
1 parent 1a28ddb commit 6aae946
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe("srtVttRender", () => {
],
} satisfies TranscriptionResult
const result = srtVttRender(transcription)
console.log(result)
assert(
result.srt.includes(
"1\n00:00:00,000 --> 00:00:01,500\nHello world\n"
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/transcription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function srtVttRender(transcription: TranscriptionResult) {

function formatSRTTime(seconds: number): string {
const date = new Date(0)
date.setSeconds(seconds)
date.setMilliseconds(seconds * 1000)
const hours = String(date.getUTCHours()).padStart(2, "0")
const minutes = String(date.getUTCMinutes()).padStart(2, "0")
const secondsPart = String(date.getUTCSeconds()).padStart(2, "0")
Expand All @@ -37,7 +37,7 @@ export function srtVttRender(transcription: TranscriptionResult) {

function formatVRTTime(seconds: number): string {
const date = new Date(0)
date.setSeconds(seconds)
date.setMilliseconds(seconds * 1000)
const hours = String(date.getUTCHours()).padStart(2, "0")
const minutes = String(date.getUTCMinutes()).padStart(2, "0")
const secondsPart = String(date.getUTCSeconds()).padStart(2, "0")
Expand Down

0 comments on commit 6aae946

Please sign in to comment.