How to check if a TimelineClip has ended?

Hi guys, I'd like to know how to check if a TimelineClip has ended inside a PlayableDirector. What I want to achieve is to restart the PlayableDirector from the beginning of a TimelineClip when that clip has ended. Now I'm trying with this simple if statement but it doesn't work:

public override TaskStatus OnUpdate()
{
      if (Director.time >= m_timelineClip.end)
      {
          Director.time = m_timelineClip.start;
      }
      return TaskStatus.Running;
}

The problem is that it doesn't enter in the If statement and I don't know how check in another way. I set the PlayableDirector WrapMode in every mode but nothing. Thank you for your support.

I was really surprised this isn't easier to do myself. For me director.time returns a value between 0 and 1. I have WrapMode of None.

I started playing around with checking the state and the time to figure this out.

public override void Update()
{
          if (director.state == PlayState.Playing)
          {
                Debug.Log($"Director time: {director.time} {director.state}");
          }
          else if (director.state == PlayState.Paused && Mathf.Approximately((float)director.time, 1))
          {
                director.Stop();
                Debug.Log($"Director time: {director.time} {director.state}");
          }
}

Playables sounds really cool and powerful but I don't know why Unity would expect it to get a lot of use in its current state. Seems like PlayableDirector needs a completed event or something like that to me.