I hadn’t known they will have stayed by next week.
There's quite a lot wrong with this sentence - so much so that I can't even guess what you are trying to say
Specifically, there are two areas that seem non-idiomatic:1. I hadn’t known they will...
I would normally expect:
I hadn’t known they would
I'm not sure if "by" is supposed to relate to "know" or "stay". Perhaps you mean "know by" or "stay until"?? Either way, I'm afraid, it seems wrong.Future Perfect
Are you trying to say:I didn't know they were going to stay until next week. ??