Validation of a Date

Hi, I just created a literal to represent dates as day of the month, month and year.

I inserted a constraint on the month value but I am not sure about the best way to check the day of the month.

I think the best way would be to have a global validator for the whole concept but it seems to be not present while I see validators for the single properties and references of the concept I would need one to express a constraint involving two properties (day of the month and month).

An alternative would be to consider in the validation of the day the current value of the month but I do not know how to check if the value of the month is inserted at all (maybe the user has not yet typed it).
1 comment
Hi, Federico,

I think the best way would be to have a global validator for the whole concept but it seems to be not present while I see validators for the single properties and references of the concept

We have such a validator - it's called "Non-typesystem rule" and can be created in typesystem aspect (don't ask why ;), we'll move it to constraints aspect later).

how to check if the value of the month is inserted at all

I don't see a "legal" way to do this, but now you can use the following hack:
ex.png
Though an error is shown, this will work at runtime.
Created an issue: http://youtrack.jetbrains.com/issue/MPS-15653

Regards,
Mihail
0

Please sign in to leave a comment.