Skip to content

Main content

Calendar Date Component Mask Tool

Encode supplied year/month/day presence as bits 4/2/1; not a date-value validator.

Loading tool…

Description

Encode supplied date-component presence into a bit mask and hierarchy flag.

Timestamp notation distinguishes written precision, quantization and carry into the next larger field. Padding a fraction, rounding it and propagating an end-of-day marker are different operations and do not establish clock accuracy.

Encode supplied date-component presence into a bit mask and hierarchy flag.

When to use this tool

Use Calendar Date Component Mask when checking one explicit timestamp precision, rounding or carry convention.

How to use the tool and how it works

  1. Enter yearPresent, monthPresent, dayPresent. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read mask, hierarchical. Inspect hierarchical before interpreting the associated values.

Encode supplied date-component presence into a bit mask and hierarchy flag. Year/month/day contribute 4/2/1; hierarchical requires day implies month and year, and month implies year.1

Input fieldMeaning and unitsAccepted input
yearPresentYear PresentRequired. Boolean.
monthPresentMonth PresentRequired. Boolean.
dayPresentDay PresentRequired. Boolean.
Output fieldInterpretationReturned shape
maskMaskRequired. Safe integer.
hierarchicalHierarchicalRequired. Boolean.
json
{
  "input": {
    "yearPresent": true,
    "monthPresent": true,
    "dayPresent": false
  },
  "output": {
    "mask": 6,
    "hierarchical": true
  }
}

Limitations and assumptions

  • Flags describe presence only, not valid numeric values, an actual date or an instant.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Use complete date-time arithmetic when a carry must change a date or interact with timezone transitions.

References

  1. Calculation and input contract: date/calendar-date-component-mask — tool.io

Similar or alternative tools