36 lines
756 B
Twig
36 lines
756 B
Twig
{%- import 'macroses/common.utils.twig' as utils -%}
|
|
|
|
{%- set hasDateFormats = dateFormats is not empty -%}
|
|
|
|
{%- if hasDateFormats %}
|
|
import LeadKit
|
|
import SwiftDate
|
|
|
|
enum ApiDateFormat: String, DateFormat {
|
|
|
|
{% for format in dateFormats -%}
|
|
case {{ format.name }} = "{{ format.format }}"
|
|
{% endfor %}
|
|
var dateToStringFormat: DateToStringStyles {
|
|
return .custom(rawValue)
|
|
}
|
|
|
|
var stringToDateFormat: StringToDateStyles {
|
|
return .custom(rawValue)
|
|
}
|
|
|
|
}
|
|
|
|
final class ApiDateFormattingService: DateFormattingService, Singleton {
|
|
|
|
typealias DateFormatType = ApiDateFormat
|
|
|
|
var currentRegion: Region = .local
|
|
|
|
static let shared = ApiDateFormattingService()
|
|
|
|
private init() {}
|
|
|
|
}
|
|
{{ "\n" }}
|
|
{%- endif -%} |