I was wondering which area would make the most sense to convert dates to UTC and back again. We store dates in UTC and convert to a users local time zone. Right now I think putting it in the repository layer makes the most sense because you don't need to remember to convert it each time you create service layer methods that require it. My teammate suggest putting it in the service layer because it is a business rule...
Where would you put these conversion function? Service layer or Repository layer? This could include looping through a list of objects and doing a convert on each one.
Where would you put these conversion function? Service layer or Repository layer?
In neither of those layers. I would put it in the view model. If the view requires showing dates in local timezone and your dates are stored in UTC in the model then the view model is the perfect place to format data that is being shown on the view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With