Depending on a few things that you define in the ViewModel, do you follow the MVCVM * (homing) MVCVM * method, in which you will have a ViewModel specific to your view, in addition to your domain models?
If so, the VM can certainly contain formatting logic, that is, the whole goal is to have this view model, primarily for the view model. So option 2.
However, the reasoning for this is that formatting yourself will start with the DRY principle if you format like this:
@Regex.Replace(Model.PhoneNumber, @"(\d{3})(\d{3})(\d{4})", "($1) $2-$3");
Since you have an extension method, there aren't many problems calling the formatter in your view at all, but I still prefer to do it in a dedicated virtual machine.
If your virtual machine is really a domain model containing raw data (see this , template 1), then this must be in your View, so Option 1. Just note that if you use this template, I would suggest against him, since he makes your view strongly connected with a low-level object, you better abstract it to what you need. that your connections between the domain model model + View are really strong (i.e. compiled at compile time, not at run time!).
First of all, it certainly should not be in your domain model.
* Model, View, Controller, ViewModel. If the ViewModel contains the data that should be used in your view, in the format in which it is required.