Age gradients throughout the Galaxy with long-period variables