I don't think there's any law that says you can't leave your dog alone in a house for a certain time.
But puppies should not be left alone longer than 2 hours at a time and adult dogs should not be left alone more than 8 hours.
If you have to leave your dog alone for longer than 8 hours you should have someone come over and watch your dog or take the dog to a kennel until you get back so they can have the proper care.