Cant Edit FDateTime Property in Editor

Hi,

I have a USTRUCT which has an EditableAnywhere, BlueprintReadWritable FDateTime UPROPERTY CurrentDateTime.

I have a variable DateTime in a Blueprint that is of this USTRUCT type and is editable.

I see the DateTime variable in the Blueprint details which has my CurrentDateTime property.

However, whenever I try to edit the value for CurrentDateTime (defaults to 0001-01-01 00:00:00) to some other date time the value switches back to the default value when I press enter or click out of the text box.

Any ideas?

EDIT:
Just as an FYI other properties on the USTRUCT are editable no problem. I can edit UEnum type, float, FRotator on the same USTRUCT which all have the same UPROPERTY definition as the FDateTime

Thanks in advance

Ha, good find! It looks like the ability to actually commit FDateTime property values wasn’t implemented.

I added a quick fix, but don’t have a way to test it right now. It should work though - please give it a shot if you build from Master, or apply the changes to your local Engine code for testing: https://github.com/EpicGames/UnrealEngine/commit/fd533f400f2d255c809fbef36a62a2a86b11f18f

Havent build 4.3 from Git yet, will have to go through the tutorial over the weekend … will let you know

Thanks

This is not fixed in 4.4.0 stable release.

Is the only way to get this fix to run the engine from source?

I’m not sure whether this change made it into 4.4.0. Would be best to try with source from the Master branch, yes.

This is not fixed in 4.5 release.

Currently if you click into the date time edit box and delete one of the characters it crashes UE4 Editor with an assertion failure (Invalid date time)

Hey Solar, where/how are you using the FDateTime field? I will try to repro it here.

I also added a more advanced details customization for FDateTime and FTimespan in https://github.com/EpicGames/UnrealEngine/commit/8717dd9637525840db6348bbdb4dbb8faa892c38, which also made it into the 4.5 branch, I think.

I’m surprised you’re still seeing some usage of the SPropertyEditorDateTime widget instead, because it should be using the customization.

Thanks for the response … I will provide details later today

I cannot reproduce the crash. I disabled the new detail customization locally, so that the original SPropertyEditorDateTime widget is being used. Upon entering invalid or incomplete date/time values, it simply sets the closest match or the last working value. In either case it does not crash.

Can you provide instructions on how exactly you’re making it crash? Can you also provide details how exactly this is used in your project? Thanks!

Hi

I have a struct defined in my c++ project that is exposed through my custom GameState class like so

USTRUCT(BlueprintType)
struct FDateTimeState
{
    GENERATED_USTRUCT_BODY()

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Time)
    TEnumAsByte<EDayCycle::Type> DayCycle;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Time)
    FDateTime GameDateTime;

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Time)
    float GameTimeRatio;

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Time)
    float TimeOfDay;

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Time)
    float TimeOfYear;

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Time)
    TEnumAsByte<EYearCycle::Type> YearCycle;
};

Now I am able to grab an instance of this struct in my blue print and can see that it is configurable in the editor

19319-configurationsection.png

If I try to delete characters in the date time text box I get an editor crash immediately (like i press the backspace key to delete first character and crash happens) and assertion failures

Assertion failed: (Year >= 1) && (Year <= 9999) [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.5\Engine\Source\Runtime\Core\Private\Misc\DateTime.cpp] [Line: 18] 

Assertion failed: (Day >= 1) && (Day <= DaysInMonth(Year, Month)) [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.5\Engine\Source\Runtime\Core\Private\Misc\DateTime.cpp] [Line: 20]

Thanks a lot! Was missing validation of the parsed date/time components. Should be fixed in GitHub Commit