Closed tcmorris closed 6 years ago
What code did you use to try and change the data type?
Like this:
tabConfig.AddField(p => p.DateProperty).SetDefaultValue(() => DateTime.Now).SetDataType("Umbraco.DateTime");
So changing "Umbraco.DateTime" to -36 instead fixed it.
Yea, the name needs to be the name of the data type instance, not the data type type. So it should be
.SetDataType("Date Picker with time")
Ah ok, my bad. Yeah that did the trick. Makes sense now as data type type is indeed something different. Not sure why I missed that, I'll close this one off as all good.
Understandable mistake, but yea, we need the data type instance as it's that which holds the pre-value config, so if we just used the type, we wouldn't know how it should be configured.
Hi Matt,
Came across a bit of an odd one earlier. I wanted to change the data type for DateTime to use the one which includes the time, not just the date. So, I checked what it is called in Umbraco and changed it over to use
Umbraco.DateTime
on my field config.Problem was, it was still showing as the default
Umbraco.Date
data type. Had a quick look through the code and it looks like we have two possible options for setting these values and the defaults are set via an id whereas I was trying to use the name.If you look here: https://github.com/umco/umbraco-fluidity/blob/da02955af10ffffbee0b0dedbec94de4b6bb287f/src/Fluidity/Configuration/FluidityEditorFieldConfig%60T.cs#L96
and here: https://github.com/umco/umbraco-fluidity/blob/da02955af10ffffbee0b0dedbec94de4b6bb287f/src/Fluidity/Configuration/FluidityEditorFieldConfig%60T.cs#L108
I'm not sure which one of these gets preference? In my case, I had to use the id version to get it working.