optimized algebra for date intervals

see issue #134