Reproduces on master.

```
SELECT toDateTime64('2021-03-22', 3, 'Asia/Tehran')

Query id: 26f7c373-f473-4209-8976-6ada79a8627f

┌─toDateTime64('2021-03-22', 3, 'Asia/Tehran')─┐
│                      2157-04-28 06:28:16.000 │
└──────────────────────────────────────────────┘
```
{
        const LUTIndex i = toLUTIndex(v);
        return toDayNum(i - (lut[i].day_of_month - 1));
    }
    
    template <typename DateOrTime>
    inline ExtendedDayNum toFirstDayNumOfQuarter(DateOrTime v) const
    {
        return toDayNum(toFirstDayOfQuarterIndex(v));
    }
    template <typename DateOrTime>
    inline LUTIndex toFirstDayOfQuarterIndex(DateOrTime v) const
    {
        LUTIndex index = toLUTIndex(v);
        size_t month_inside_quarter = (lut[index].month - 1) % 3;
        index -= lut[index].day_of_month;
        while (month_inside_quarter)
        {
            index -= lut[index].day_of_month;
            --month_inside_quarter;
        }
        return index + 1;
    }
    template <typename DateOrTime>
    inline Time toFirstDayOfQuarter(DateOrTime v) const