[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [xacml] Question on Time Extensions
Hi David, On 4/10/2019 5:53 am, David Brossard wrote:
Hi Hal, I think there is a need for a function that can take a range of weekdays (Monday, Friday) and compare that to the current date's (or any date) day of the week. Do we have that today? For instance, what if you wanted to write a policy that states: * Permit on Mondays and Fridays The only way to do so today would be to write a custom function that would extract the day of the week the date is on and then compare to these two. Steven, is that what you're trying to do?
That sort of thing is the main use case for the dayOfWeek data-type and can be achieved with the dateTime-in-dayOfWeek-range function. We can test if a dateTime falls on a particular day of the week by setting the second and third arguments to the same value. The second argument is converted to the dateTime of the first instant on the day and the third argument is converted to the dateTime of the last instant on the day. So Mondays and Fridays (for me) would be: dateTime-in-dayOfWeek-range(current-dateTime, "1+10:00", "1+10:00") or dateTime-in-dayOfWeek-range(current-dateTime, "5+10:00", "5+10:00") If I were interested in Mondays *to* Fridays I would use: dateTime-in-dayOfWeek-range(current-dateTime, "1+10:00", "5+10:00") I don't have a current need for an equality function for dayOfWeek values, though data-types conventionally have an equality function. Regards, Steven