I previously wrote about my generally positive experiences with Starling Bank. At the time it was difficult to move money between your accounts, for example between a personal and joint or business and personal account. You had to add yourself as a payee, which was a bit inconvenient. They shipped an update with a new feature to make this easier but the original implementation had an annoying bug. Scroll down, there is a lot of whitespace in the UI.
The app would only let you move money on a weekday, although the text said between 2am and 10pm Monday to Friday (it thought it was an international transfer) it did in-fact work on weekday evenings. This was also based on the local time of the phone and not the time / day in the UK. Perhaps changing the time on your device would work around this but now you can just update the app for the bug fix.
This bug and the continuing lack of notifications for other account holders when using this feature suggests that they have bypassed the standard Faster Payments system and may have reused some existing functionality that wasn’t originally intended for this purpose. Perhaps this saves on transfer fees.
Let this be a lesson to always write tests that thoroughly exercise your date and time logic, including edge cases. Times and time-zones are hard, and shouldn’t be underestimated.
In a .NET project I will typically mock out the date and time provider so it can be tested. It’s a good idea to use an interface for time requests and inject the implementation into your app at runtime. You can then inject a mock provider for testing and use a simple pass-through in the real app.
You can do something very similar in Java, which is what the Android app and API back-end are using in this case (although the back-end appears to be working correctly and it’s just the app). C# was
blatantly copied from inspired by Java but in recent years it has moved ahead and now has more features (particularly the upcoming C# 8.0).
Basically, never call
DateTime.Now directly. You should be using UTC anyway and potentially capturing the offset information too, depending on the use-case.
You may like to try Noda Time, an alternative date and time API for .NET.
It’s a good idea to mock time like you would do with file IO (perhaps using a library such as System.IO.Abstractions). If you want to learn more about how to use dates and times correctly then you may like to read my book.