You have to consider the Invoice date, as you said above that if you purchase product in may and which will delivered in june then in this situation, you have to consider the date at which invoice was prepared. AS PER YOUR EXAMPLE-
Situation 1- If invoice show MAY month date then you can book gst input in MAY month and can take credit of that in JUNE month while making payment of MAY month gst (other than reverse charge).
Situation 2 - If invoice show JUNE month date then you can book gst input in JUNE month and can take credit of that in JULY month while making payment of JUNE month gst (other than reverse charge).