Capillary hysteresis in sloshing dynamics: aweakly nonlinear analysis