@yuhunglin indeed, you should be able to re-use this in a filter/directive/controller as well.
Don't inject the dateService though, just the apiService which will then inject the dateService automatically.