Issue with date formatting

I'm having a similar problem.
I ahve a montlhy calendar where I want to display the schedules.
I have created a script function that is called inside in the dataEvent with the use of the expression function runScript().
This is the script that retrieves the next schedules

def getCalendar():
	#I create an empty dataset
	header = ["startDate","endDate","displayColor","display"]
	calendar = system.dataset.toDataSet(header,[])
	turni=["Turno 1","Turno 2","Turno 3","Turno 4"]
	displayColors=["blue","orange", "green","red"]
	for turno in turni:
                #custom functions that get the next start date of the schedule and the next end date
		display=turno + ": "
		for user in users:
			display=display + user + " "
		#Popolo le righe del ddataset con le date di inizio e fine dei 4 turni
		newRow = [startDateTurno,endDateTurno,displayColor,display]
		calendar = system.dataset.addRow(calendar,newRow)
	return calendar

When the page is opened the script runs and a dataset with the data is created but the start and end dates are in the String type and so no event are displayed.
When I retrieve the two dates inside the function they are in the date format but the datsaet column are in the String type.
To prove that I used the for all the dates and the dataset in the calendar but still the data format is String

I was able to recreate your problem using a script to add a row to a dataset that was already created in a power table:

Source Code
data = event.source.parent.getComponent('Power Table').data
row = [, -1),] 
event.source.parent.getComponent('Power Table').data = system.dataset.addRow(data, row)

I was able to correct it by deleting the column in the dataset editor, and then recreating it in the dataset editor as a date column

1 Like

This is the problem.

When you provide no data, all columns default to String.

Don't use system.dataset.addRow() to build your dataset. Build a list of rows (list of lists) with all of your data, then call system.dataset.toDataSet() just once, after the loop, to create your final dataset.

Or, if you want precise control over your column data types (especially if any value in the first row is None), use the DatasetBuilder class.