File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "fmt"
5
+ "time"
6
+
7
+ "github.com/gitploy-io/cronexpr"
8
+ )
9
+
10
+ func main () {
11
+ nextTime := cronexpr .MustParseInLocation ("0 * * * *" , "Asia/Seoul" ).Next (time .Now ())
12
+ fmt .Printf ("Parse the cron expression in the KR timezone: %s" , nextTime )
13
+ }
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ func (s *Schedule) Next(t time.Time) time.Time {
18
18
loc = s .Location
19
19
}
20
20
21
+ origLoc := t .Location ()
21
22
t .In (loc )
22
23
23
24
added := false
92
93
}
93
94
}
94
95
95
- return t
96
+ return t . In ( origLoc )
96
97
}
97
98
98
99
func (s * Schedule ) Prev (t time.Time ) time.Time {
@@ -101,6 +102,7 @@ func (s *Schedule) Prev(t time.Time) time.Time {
101
102
loc = s .Location
102
103
}
103
104
105
+ origLoc := t .Location ()
104
106
t .In (loc )
105
107
106
108
subtracted := false
176
178
}
177
179
}
178
180
179
- return t
181
+ return t . In ( origLoc )
180
182
}
181
183
182
184
// dayMatches returns true if the schedule's day-of-week and day-of-month
You can’t perform that action at this time.
0 commit comments