We have a rule that all code that deals with datetime does so in UTC. So when code retrieves a datetime value from a UI it is converted from local time to UTC. Likewise when code puts a datetime value to a UI it is converted from UTC to local time. This is pre-MVVM. Now I'm rethinking the architecture and viewing it in MVVM.
Given that the UI is bound to backing viewmodel properties it seems that the properties on the viewmodel would be in local time. This isn't great as it adds gray area into the rule that all code is UTC. However, the separation of the UI may trump that. Let's say it does.
So all code is UTC except viewmodel properties bound to a UI. I see quite a bit of sample MVVM code that uses the same properties for other viewmodel work. If this were the case the local time now leaks further into code.
What am I missing here? Is it possible for the viewmodel properties bound to the UI to be UTC? If not, should viewmodel properties of this nature be built in pairs (i.e. a local version bound to the UI and a UTC version used internally by the rest of the viewmodel code)?
Add your 2¢