@stacksjs/git 0.64.6 → 0.67.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.
package/src/index.ts DELETED
@@ -1,65 +0,0 @@
1
- export * as changelog from 'changelogen'
2
-
3
- export function useGitHub() {
4
- function getTimeDifference(givenDateString: string): string {
5
- // Convert the given date string to a Date object
6
- const givenDate: Date = new Date(givenDateString)
7
-
8
- // Get the current date and time
9
- const currentDate: Date = new Date()
10
-
11
- // Calculate the time difference in milliseconds
12
- const timeDifference: number = currentDate.getTime() - givenDate.getTime()
13
-
14
- // Calculate the difference in seconds, minutes, hours, and days
15
- const secondsDifference: number = Math.floor(timeDifference / 1000)
16
- const minutesDifference: number = Math.floor(secondsDifference / 60)
17
- const hoursDifference: number = Math.floor(minutesDifference / 60)
18
- const daysDifference: number = Math.floor(hoursDifference / 24)
19
- const weeksDifference: number = Math.floor(daysDifference / 7)
20
-
21
- if (secondsDifference < 60) {
22
- // If less than 60 seconds, return seconds only
23
- return `${secondsDifference}s`
24
- }
25
-
26
- if (minutesDifference < 60) {
27
- // If less than 60 minutes, return minutes and remaining seconds
28
- const remainingSeconds = secondsDifference % 60
29
- return `${minutesDifference}m ${remainingSeconds}s`
30
- }
31
-
32
- if (hoursDifference < 24) {
33
- // If less than 24 hours, return hours and remaining minutes
34
- const remainingMinutes = minutesDifference % 60
35
- return `${hoursDifference}h ${remainingMinutes}m`
36
- }
37
-
38
- if (weeksDifference < 7) {
39
- const remainingHours: number = hoursDifference % 24
40
-
41
- return `${daysDifference}d ${remainingHours}h`
42
- }
43
-
44
- return `${weeksDifference}w`
45
- }
46
-
47
- function formatDuration(durationInSeconds: number): string {
48
- const minutes = Math.floor(durationInSeconds / 60)
49
- const seconds = durationInSeconds % 60
50
-
51
- if (minutes > 1) return `${minutes}m ${seconds}s`
52
-
53
- return `${seconds}s`
54
- }
55
-
56
- function getActionRunDuration(startTime: Date, endTime: Date): string {
57
- const start = new Date(startTime)
58
- const end = new Date(endTime)
59
- const durationInSeconds = Math.floor((end.getTime() - start.getTime()) / 1000)
60
-
61
- return formatDuration(durationInSeconds)
62
- }
63
-
64
- return { getTimeDifference, formatDuration, getActionRunDuration }
65
- }