Hoping someone can help me. I’m trying to create a filter query in a flow, like this.
“filter”: {
“day_name”: {
“_eq”: “weekday($NOW)”
}
Note, this works fine:
“filter”: {
“day_name”: {
“_eq”: “Monday”
}
Hoping someone can help me. I’m trying to create a filter query in a flow, like this.
“filter”: {
“day_name”: {
“_eq”: “weekday($NOW)”
}
Note, this works fine:
“filter”: {
“day_name”: {
“_eq”: “Monday”
}
First of all weekday() function is returning the index of the weekday from 0 to 6 where 0 is either Sunday or Monday (Monday in my case, not sure if this is influenced by any internationalization option).
Nevertheless I was not able to use weekday function passing dynamic $NOW weekday($NOW).
I am not sure if there is an easier solution, but you can run a script operation to get the current weekday name prior to your data operation
module.exports = async function(data) {
const today = new Date();
const weekdayName = today.toLocaleDateString('en-US', { weekday: 'long' });
return weekdayName;
}
and then use the ($last) result in the following data operation
{
"filter": {
"day_name": {
"_eq": "{{$last}}"
}
}
}