SwiftDate: 'DateComponentsFormatter' is unavailable for Linux

Hi,

when compiling with Linux I get this error (using version 6.1 and Swift 5):

TimeInterval+Formatter.swift:34:38: error: 'DateComponentsFormatter' is unavailable: Not supported in swift-corelibs-foundation
                public var zeroFormattingBehavior: DateComponentsFormatter.ZeroFormattingBehavior?
                                                   ^~~~~~~~~~~~~~~~~~~~~~~
Foundation.DateComponentsFormatter:2:12: note: 'DateComponentsFormatter' has been explicitly marked unavailable here

Seems to me that DateComponentsFormatter is not available for Linux (unfortunately, I couldn’t find out if it‘s just not there yet or never will be).

Any idea how I can get around this?

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 6
  • Comments: 19

Most upvoted comments

@malcommac Please consider either fixing this or removing the claim that this library works for Linux.

There is only one way to compile SwiftDate library on Linux - disable using of DateComponentsFormatter. I’ve made changes to compile my project on Linux. You can use it: .package(url: "https://github.com/Maxim-Inv/SwiftDate.git", .branch("master")),

@patchthecode as you said I just commented a few lines of code only to avoid error on Linux. I think it only a workaround, not a fix.