'How can I validate min max setting dynamic value?

when I am using exact number, its working. but when I am using dynamic value , validation not working.this is created with react-hook-form validation.

                          <div class="form-control">
                                <label class="label">
                                    <span class="label-text">Quantity</span>
                                </label>
                                <input type="number" placeholder={minOrder} {...register("quantity", {required: true, max: {stock}, min: {minOrder}})} />
                                <label class="label">
                                {errors.quantity?.type === 'min' && <span class="label-text-alt text-red-600 font-bold">You must fulfill the minimum order</span>}
                                {errors.quantity?.type === 'max' && <span class="label-text-alt text-red-600 font-bold">Out of Stock</span>}
                               </label>
                                </div>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source