How to know when default rangeselector button was pressed

I have a rangeslider with default rangeselector buttons and I must know when one of the buttons was pressed to allow me calculate other values based on that range, according to piece of code below.

It’d be nice if these buttons could have an “id”, but they don’t.

Appreciante any help.

rangeslider=dict(),
type=‘date’,
rangeslider_visible = True,
rangeslider_thickness = 0.2,
rangeslider_bgcolor = “#fafafa”,
rangeslider_bordercolor = “black”,
rangeslider_borderwidth = 2,

        rangeselector = dict(
            buttons = list([
                dict(count=5, label="5D", step = 'day', stepmode = 'backward', name='5D'),
                dict(count=15, label="15D", step = 'day', stepmode = 'backward', name='15D'),
                dict(count=1, label="1M", step = 'month', stepmode = 'backward', name='1M'),
                dict(count=3, label="3M", step = 'month', stepmode = 'backward', name='3M'),
                dict(count=6, label="6M", step = 'month', stepmode = 'backward', name='6M'),
                dict(count=1, label="YTD", step = 'year', stepmode = 'todate', name='YTD'),
                dict(count=1, label="1Y", step = 'year', stepmode = 'backward', name='1Y'),
                dict(count=2, label="2Y", step = 'year', stepmode = 'backward', name='2Y'),
                dict(step="all", name='all')])) 

Wander