class urn_perun_member_attribute_def_def_membershipExpiration extends MemberAttributesModuleAbstract implements MemberAttributesModuleImplApi {

	@Override
	public void checkAttributeSyntax(PerunSessionImpl perunSession, Member member, Attribute attribute) throws WrongAttributeValueException {

		String membershipExpTime = attribute.valueAsString();

		if(membershipExpTime == null) return; // NULL is ok

		Date testDate;

		try {
			testDate = BeansUtils.getDateFormatterWithoutTime().parse(membershipExpTime);

		} catch (ParseException ex) {

			throw new WrongAttributeValueException(attribute, "Date parsing failed", ex);
		}

		if (!BeansUtils.getDateFormatterWithoutTime().format(testDate).equals(membershipExpTime)) {

			throw new WrongAttributeValueException(attribute, "Wrong format yyyy-MM-dd expected.");
		}

	}

}