Hide Loader before duration is over

How can I hide a loader before it is set to end based on the duration?