Notice the that h must equal +3 because there's a negative sign in the vertex form of the equation. Just remember to change the sign. That's all.
In your second example , you have a positive sign inside parentheses. The only way that can happen is if h is negative.
Bottom line..when you take that coordinate out of parentheses, change its sign.