Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit077284f

Browse files
committed
web: remove unused function expandScheduleCronString
1 parentf65dbba commit077284f

File tree

3 files changed

+3
-35
lines changed

3 files changed

+3
-35
lines changed

‎site/src/components/Workspace/WorkspaceSchedule.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Box from "@material-ui/core/Box"
22
importTypographyfrom"@material-ui/core/Typography"
33
importcronstruefrom"cronstrue"
44
importReactfrom"react"
5-
import{expandScheduleCronString,extractTimezone}from"../../util/schedule"
5+
import{stripTimezone,extractTimezone}from"../../util/schedule"
66
import{WorkspaceSection}from"./WorkspaceSection"
77

88
constLanguage={
@@ -26,7 +26,7 @@ const Language = {
2626
},
2727
cronHumanDisplay:(schedule:string):string=>{
2828
if(schedule){
29-
returncronstrue.toString(expandScheduleCronString(schedule),{throwExceptionOnParseError:false})
29+
returncronstrue.toString(stripTimezone(schedule),{throwExceptionOnParseError:false})
3030
}
3131
return"Manual"
3232
},

‎site/src/util/schedule.test.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import{expandScheduleCronString,extractTimezone,stripTimezone}from"./schedule"
1+
import{extractTimezone,stripTimezone}from"./schedule"
22

33
describe("util/schedule",()=>{
44
describe("stripTimezone",()=>{
@@ -20,14 +20,4 @@ describe("util/schedule", () => {
2020
expect(extractTimezone(input)).toBe(expected)
2121
})
2222
})
23-
24-
describe("expandScheduleCronString",()=>{
25-
it.each<[string,string]>([
26-
["CRON_TZ=Canada/Eastern 30 9 1-5","30 9 * * 1-5"],
27-
["CRON_TZ=America/Central 0 8 1,2,4,5","0 8 * * 1,2,4,5"],
28-
["30 9 1-5","30 9 * * 1-5"],
29-
])(`expandScheduleCronString(%p) returns %p`,(input,expected)=>{
30-
expect(expandScheduleCronString(input)).toBe(expected)
31-
})
32-
})
3323
})

‎site/src/util/schedule.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,3 @@ export const extractTimezone = (raw: string): string => {
3030
returnDEFAULT_TIMEZONE
3131
}
3232
}
33-
34-
/**
35-
* expandScheduleCronString ensures a Schedule is expanded to a valid 5-value
36-
* cron string by inserting '*' in month and day positions. If there is a
37-
* leading timezone, it is removed.
38-
*
39-
*@example
40-
* expandScheduleCronString("30 9 1-5") // -> "30 9 * * 1-5"
41-
*/
42-
exportconstexpandScheduleCronString=(schedule:string):string=>{
43-
constprepared=stripTimezone(schedule).trim()
44-
45-
constparts=prepared.split(" ")
46-
47-
while(parts.length<5){
48-
// insert '*' in the second to last position
49-
// ie [a, b, c] --> [a, b, *, c]
50-
parts.splice(parts.length-1,0,"*")
51-
}
52-
53-
returnparts.join(" ")
54-
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp