Now I am not saying I agree with this law, I am Christian and according to how I and those I live with practice it, fasting is strictly individual, something I personally would even try to hide according to Jesus words in Matthew 6. 16, 17 and particularly 18:
> «that thou appear not unto men to fast, but unto thy Father which is in secret: and thy Father, which seeth in secret, shall reward thee openly.» Matthew 6:18 KJV https://bible.com/bible/1/mat.6.18.KJV
Maybe expressing that you're fasting could be seen as bad. As if you're trying to boast about it, how you're better then others.
Which made me that, if people that eat a vegan diet (or similar) kept it to themselves and not force it onto others, then perhaps there wouldn't exist the culture of "I ate a steak in front of vegans" or "I don't mind if you're vegan, but please let me eat in peace".
Each of these might have value on their own, but God will only reward us if we do it for him instead of doing it to seek the glory of men.
I don't know for judges, but I live in a dominantly religious society and I haven't noticed the virtues promised by observing strict religious fasting. In fact, people have been jailed by (probably fasting) judges for eating out of sight [1].
[1] https://www-lepoint-fr.translate.goog/monde/algerie-2-ans-de...