24 lines
631 B
Twig
24 lines
631 B
Twig
import LeadKit
|
|
import ObjectMapper
|
|
|
|
final class ApiDateFormattingService: DateFormattingService {
|
|
|
|
static let shared = ApiDateFormattingService()
|
|
|
|
private init() {
|
|
super.init(formattingArguments: [
|
|
{% for dateFormat in dateFormats -%}
|
|
DateFormattingArguments(dateFormat: "{{ dateFormat }}"){% if not (loop.last) %},{%- endif %}
|
|
{% endfor %}
|
|
])
|
|
}
|
|
}
|
|
|
|
extension ApiDateFormattingService {
|
|
|
|
func mappingTransform(for dateFormat: String) -> TransformOf<Date, String> {
|
|
return mappingTransform(for: DateFormattingArguments(dateFormat: dateFormat))
|
|
}
|
|
|
|
}
|