leap-year

wkov/colony/leap-year

No description
leap-year
@/leap-year
YEARnumber
Year number, from 0.
leap-year
YEAR
LEAP
LEAPboolean
True, if year of leap.
To use the node in your project you should have the wkov/colony library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD dirtieness disable

node {
    void evaluate(Context ctx) {
        uint32_t year = getValue<input_YEAR>(ctx);
        emitValue<output_LEAP>(ctx, ((year % 400 == 0) || (year % 100 != 0) && (year % 4 == 0)));
    }
}

Tabular tests

YEARLEAP
2023false
2024true