# BR-KSA-36

Source: https://xmlvalid.com/rules/BR-KSA-36

> If the invoice contains a supply end date (KSA-24), then this date must be greater than or equal to the supply date (KSA-5).

- Level: warning
- Rule sets: ZATCA e-invoicing rules (Saudi Arabia) SDK 3.4.6
- Context: `cac:Delivery/cbc:LatestDeliveryDate`
- Test: `not(exists(../cbc:ActualDeliveryDate) and normalize-space(../cbc:ActualDeliveryDate) != '') and not (string-length(string(../cbc:ActualDeliveryDate)) = 10 and matches( string(../cbc:ActualDeliveryDate),'((18|19|20)[0-9]{2}[\-](0[13578]|1[02])[\-](0[1-9]|[12][0-9]|3[01]))|(18|19|20)[0-9]{2}[\-](0[469]|11)[\-](0[1-9]|[12][0-9]|30)|(18|19|20)[0-9]{2}[\-](02)[\-](0[1-9]|1[0-9]|2[0-8])|(((18|19|20)(04|08|[2468][048]|[13579][26]))|2000)[\-](02)[\-]29')) and not (string-length( .)= 10 and matches(string( .),'((18|19|20)[0-9]{2}[\-](0[13578]|1[02])[\-](0[1-9]|[12][0-9]|3[01]))|(18|19|20)[0-9]{2}[\-](0[469]|11)[\-](0[1-9]|[12][0-9]|30)|(18|19|20)[0-9]{2}[\-](02)[\-](0[1-9]|1[0-9]|2[0-8])|(((18|19|20)(04|08|[2468][048]|[13579][26]))|2000)[\-](02)[\-]29') )and xs:date(.) >= xs:date(../cbc:ActualDeliveryDate)`

Validate a document against these rules: https://xmlvalid.com/validate
