Yaw dampers have no knowledge or care about compass information.
They are rate devices. A yaw rate causes a signal to deflect the rudder. Once the yaw RATE stops, the rudder will centralize, even if you are not flying straight. Once the yaw coming back starts, the damper will oppose the movement according to the rate of change. Purely gyro based.
Simple and very useful.