I'm playing around with MPS, and I have created my own ISO 8601 concept. I'm writing property constraints for every part, and I've got a bit of code to validate that the day is a valid one for the chosen year and month:
int daysInMonth = YearMonth.of(node.year, node.month).lengthOfMonth();
propertyValue >= 1 && propertyValue <= daysInMonth;
That said, I've noticed that if I unset the year/month, the old values are still "there" for the purposes of validation. I'd like to make the code just use the generic 1-31 day range if the year or the month are not set. However, I haven't found any way to check if node.year and/or node.month are set from the code.
Am I missing something? How can you check if a certain attribute is set or not?