refactor: Extract time calculation logic for topic muting.
refactor: Extract time calculation logic for topic muting.

This is a prep change for implementing the mute users
feature, so that this code can be reused.

andersk/zulip,zulip/zulip,hackerkid/zulip,rht/zulip,zulip/zulip,zulip/zulip,kou/zulip,hackerkid/zulip,hackerkid/zulip,punchagan/zulip,rht/zulip,andersk/zulip,zulip/zulip,punchagan/zulip,zulip/zulip,hackerkid/zulip,punchagan/zulip,kou/zulip,punchagan/zulip,kou/zulip,andersk/zulip,rht/zulip,eeshangarg/zulip,punchagan/zulip,andersk/zulip,zulip/zulip,punchagan/zulip,punchagan/zulip,rht/zulip,andersk/zulip,kou/zulip,kou/zulip,andersk/zulip,kou/zulip,eeshangarg/zulip,andersk/zulip,eeshangarg/zulip,hackerkid/zulip,zulip/zulip,rht/zulip,hackerkid/zulip,rht/zulip,eeshangarg/zulip,kou/zulip,eeshangarg/zulip,rht/zulip,eeshangarg/zulip,eeshangarg/zulip,hackerkid/zulip