Phyton : DateTime not being accepted in filter

Hello guys, pretty new to spotfire scripting API.

Code here : 

import Spotfire.Dxp.Application.Filters as filters
import Spotfire.Dxp.Application.Filters.ListBoxFilter
import time
from datetime import datetime, timedelta, date
from Spotfire.Dxp.Application.Filters import FilterTypeIdentifiers
from Spotfire.Dxp.Data import *
from Spotfire.Dxp.Application.Filters import *
from Spotfire.Dxp.Data.DataType import Date

f = open("C:\\Users\\ng6ce1f\\Documents\\TEST.txt", 'w', 0)
#Get Filter page
filterPanel = dataPage.FilterPanel

#Get all filters we wish to adjust, and adapt them if needed (from a range to checkbox for example)
#Getfilter return a filterReference, so we have to set his type and then get the filter using filterName.FilterReference.As[TypeFilter]() (which cast the filter so python knows we can acces specific methods)
msnFilterReference = filterPanel.TableGroups[0].GetFilter("MSN")
msnFilterReference.FilterReference.TypeId = FilterTypeIdentifiers.RangeFilter
msnFilter = msnFilterReference.FilterReference.As[RangeFilter]()

handoverDateFilterReference = filterPanel.TableGroups[0].GetFilter("MSN Handover date")
handoverDateFilterReference.FilterReference.TypeId = FilterTypeIdentifiers.RangeFilter
handoverDateFilter = handoverDateFilterReference.FilterReference.As[RangeFilter]()

deliverDateFilterReference = filterPanel.TableGroups[0].GetFilter("MSN Indus Delivery date")
deliverDateFilterReference.FilterReference.TypeId = FilterTypeIdentifiers.RangeFilter
deliveryDateFilter = deliverDateFilterReference.FilterReference.As[RangeFilter]()

#Get properties in our Filter page
selectedMSN = Document.Properties["MSNSelect"]
selectedHandoverDate = Document.Properties["HandoverDateSelected"]
selectedDeliveryDate = Document.Properties["DeliveryDateSelected"]

#Depending on the chosen properties, we adjust our filters accordingly
#Set msn filter
if selectedMSN == "7000More":
    msnFilter.ValueRange = ValueRange(7000,msnFilter.ValueRange.High)
elif selectedMSN == "7000Less":
    msnFilter.ValueRange = ValueRange(msnFilter.ValueRange.Low,6999)
else:
    msnFilter.ValueRange = ValueRange(msnFilter.ValueRange.Low, msnFilter.ValueRange.High)
    
#Set Handover date filter
currentDate = Date.Formatter.Parse(time.strftime("%d/%m/%Y"))
if selectedHandoverDate == "PastHandover":
    handoverDateFilter.ValueRange = ValueRange(handoverDateFilter.ValueRange.Low ,currentDate)
elif selectedHandoverDate == "FuturHandover":
    handoverDateFilter.ValueRange = ValueRange(currentDate,handoverDateFilter.ValueRange.High)
else:
    handoverDateFilter.ValueRange = ValueRange(handoverDateFilter.ValueRange.Low,handoverDateFilter.ValueRange.High)
    
#Set Delivery date filter
dateTimePlusWeek = datetime.today() + timedelta(days=7)
datePlusWeek = dateTimePlusWeek.date()
if selectedDeliveryDate == "DeliveryNextWeek":
    deliveryDateFilter.ValueRange = ValueRange(deliveryDateFilter.ValueRange.Low ,datePlusWeek)
else:
    f.write("else")
    deliveryDateFilter.ValueRange = ValueRange(deliveryDateFilter.ValueRange.Low,deliveryDateFilter.ValueRange.High)

f.close()
#Goto Data page
Document.ActivePageReference=dataPage
 

What is interesting here is :

#Set Delivery date filter
dateTimePlusWeek = datetime.today() + timedelta(days=7)
datePlusWeek = dateTimePlusWeek.date()
if selectedDeliveryDate == "DeliveryNextWeek":
    deliveryDateFilter.ValueRange = ValueRange(deliveryDateFilter.ValueRange.Low ,datePlusWeek)

I have a dateRange filter that I got earlier, and I want to set my date to Today + 7 days, then set the filter using this new date. Problem is, nothing is changing, and no error. I don't understand because I also use a datetime for the previous filter setting and it works perfectly, but here it does not. Would you have any idea why ? Thank you.

 

EDIT : After some research, if I use datetime.today() instead of Date.Formatter.Parse(time.strftime("%d/%m/%Y")) in the Set Handover date filter, it stops working too. So now I'm looking for a way to get a date seven days from now using something like Date.Formatter.Parse(time.strftime("%d/%m/%Y"))

(1) Answer

Login