Timezone in current-date in zatca rules

In most servers that uses ubuntu they always use utc timezone which is a problem in here

               <xsl:if test="(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 not(xs:date(.) &lt;= current-date())">
                  <svrl:failed-assert xmlns:svrl="http://purl.oclc.org/dsdl/svrl" location="{schxslt:location(.)}" flag="error" id="BR-KSA-04">
                     <xsl:attribute name="test">xs:date(.) &lt;= current-date()</xsl:attribute>
                     <svrl:text>[BR-KSA-04]-The document issue date (BT-2) must be less or equal to the current date.</svrl:text>
                     <svrl:message-code>BR-KSA-04</svrl:message-code>
                     <svrl:message-category>KSA - business rules (BR-KSA)</svrl:message-category>
                  </svrl:failed-assert>
               </xsl:if>

In

               <xsl:if test="(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 not(xs:date(.) &lt;= current-date())">

It says current-date which is wrong and it would get any timezone and in windows the same issue it might go for diff timezone

So my proposal fix is to do this

<xsl:if test="
  string-length(.) = 10
  and matches(., '((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(xs:date(.) &lt;= adjust-date-to-timezone(current-date(), xs:dayTimeDuration('PT3H')))
">

Here I used adjust-date-to-timezone to xs:dayTimeDuration('PT3H') which is KSA valid timezone
There could be a better solution but this is my temporary fix for it.

1 Like

@wisamidris7 Invoice Issue Time (KSA-25) can be provided in UTC timezone by adding a suffix Z at the end of HH:MM:SS. For example, 13:59:59Z.

2 Likes

Thanks @Ankit.K.Tiwari, It worked.