For the completist in me !
{
"to": "tablename",
"data": [
{% set ns = namespace(adate=(time.now|timezone('Asia/Calcutta'))) %}
{% for num in range(7) %}
{% set ns.adate = ns.adate + time.delta(days=1) %}
{# Check if the date is Saturday (5) or Sunday (6) #}
{% if ns.adate.weekday() == 5 %}
{# If it's Saturday, add 2 days to make it Monday #}
{% set ns.adate = ns.adate + time.delta(days=2) %}
{% elif ns.adate.weekday() == 6 %}
{# If it's Sunday, add 1 day to make it Monday #}
{% set ns.adate = ns.adate + time.delta(days=1) %}
{% endif %}
{
"7": {
"value": "{{ ns.adate }}-{{ ns.adate.strftime('%A') }}"
}
}
{% if not loop.last %},{% endif %}
{% endfor %}
]
}
------------------------------
Prashant Maheshwari
------------------------------