Function parseStringYear

  • Parses a string into a CronYear.

    Example

    parseStringYear("1989"); // 1989,
    parseStringYear("*"); // "*",
    parseStringYear("1989/10"); // { every: 10, start: 1989 },
    parseStringYear("?/10"); // { every: 10, start: "?" },
    parseStringYear("1989,1991,2015,2020"); // [1989, 1991, 2015, 2020],
    parseStringYear("1989-2020"); // { from: 1989, to: 2020 },
    parseStringYear("1989,1991,2015,2020,1989-2020"); // [1989, 1991, 2015, 2020, { from: 1989, to: 2020 }],
    parseStringYear("INVALID"); // undefined,
    parseStringYear("1,2,3,4,INVALID"); // undefined,

    Returns

    A CronYear or undefined if invalid.

    Parameters

    • source: string

      string to be parsed.

    Returns Maybe<CronPart<CronYearValue>>