Subgroups Analysis when Treatment and Moderators are Time-Varying