Skip to content

Latest commit

 

History

History
14 lines (12 loc) · 488 Bytes

using-a-custom-date-formatter.md

File metadata and controls

14 lines (12 loc) · 488 Bytes

How to use a custom date formatter

If you’d like Publish to use a custom DateFormatter, rather than its built-in one (which decodes dates using the yyyy-MM-dd HH:mm format), then you can assign a new instance to the current PublishingContext within a custom step:

try MyWebsite.publish(using: [
    ...
    .step(named: "Use custom DateFormatter") { context in
        let formatter = DateFormatter()
        ...
        context.dateFormatter = formatter
    }
])