Governance Voting Power based on staking

Hello Everyone
I am using openzeppelin Governance contract
i want to made some changes in terms of "how to calculate the voting power"

I want to calculate voting power like that

VP = T * M
Where:
● VP is voting power
● T is the number of tokens staked
● M is a duration based multiplier
We can then define M as follows:
M = 0.75 + 0.3 D^0.33
Where ( ) is the duration of the stake in weeks, this gives us the following multiplier
curve based on duration.

Can anyone help me out,how to implement it with disturbing all the Governance and TimelockController contracts.
Thanks

You need to define something like our GovernorVotes contract.

You can replace getVotes with a function that implements your formula.

Does your staking or token contract track duration?