Like many screen recorders, you can record content up to maximum number of GB available on the partition you store the recorded video. When the space is depleted the recording stops. So if you have a big partition where you store the file, maximum duration is based only on the available space left.
If you use the built-in screen recorder - Game DVR, the maximum duration is 30 m. And if you use the third-party screen recorder like OBS, VLC, Joyoshare VidiKit, the maximum duration is up to yourself.