Files
supercronic/cronexpr/example_test.go
Thomas Orozco a3bd41c5d4 Vendor cronexpr in-tree
Rather than depend on a fork, let's incorporate cronexpr directly here.
Cronexpr won't ever receive updates at this point, so keeping it as a
fork so we could switch back to master is a bit pointless.

Incorporating it here into Supercronic gives us CI for free (which we
don't get in a fork), and it makes commits incorporating changes to
cronexpr clearer (since we can see the code changes instead of just a
dependency change).
2020-11-24 08:50:17 +00:00

36 lines
854 B
Go

/*!
* Copyright 2013 Raymond Hill
*
* Project: github.com/aptible/supercronic/cronexpr/example_test.go
* File: example_test.go
* Version: 1.0
* License: GPL v3 see <https://www.gnu.org/licenses/gpl.html>
*
*/
package cronexpr
/******************************************************************************/
import (
"fmt"
"time"
)
/******************************************************************************/
// ExampleMustParse
func ExampleMustParse() {
t := time.Date(2013, time.August, 31, 0, 0, 0, 0, time.UTC)
nextTimes := MustParse("0 0 29 2 *").NextN(t, 5)
for i := range nextTimes {
fmt.Println(nextTimes[i].Format(time.RFC1123))
// Output:
// Mon, 29 Feb 2016 00:00:00 UTC
// Sat, 29 Feb 2020 00:00:00 UTC
// Thu, 29 Feb 2024 00:00:00 UTC
// Tue, 29 Feb 2028 00:00:00 UTC
// Sun, 29 Feb 2032 00:00:00 UTC
}
}