From ebc1c3f143dbf2e91889058d3c4e6bc0e07df8dc Mon Sep 17 00:00:00 2001 From: Paolo Prodossimo Lopes <70642432+PaoloProdossimoLopes@users.noreply.github.com> Date: Fri, 16 May 2025 07:21:20 -0300 Subject: [PATCH 1/8] =?UTF-8?q?=F0=9F=91=B7=20configuring=20CI=20to=20be?= =?UTF-8?q?=20reusable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/swift.yml | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 1854bb4..baaa254 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -1,20 +1,7 @@ -name: Swift +name: Swift Package Manager -on: - pull_request: - branches: [ "develop" ] +on: [push, pull_request] jobs: - build: - runs-on: macos-latest - - steps: - - uses: actions/checkout@v4 - - name: Setup Swift - uses: fwal/setup-swift@v2 - with: - swift-version: '6.0.0' - - name: Build - run: swift build -v - - name: Run tests - run: swift test -v \ No newline at end of file + use-reusable: + uses: EasyPackages/.github/.github/workflows/ci.yml@main From 855ddfe91c882a9c0d5133fa58c156a88ba99855 Mon Sep 17 00:00:00 2001 From: Paolo Prodossimo Lopes <70642432+PaoloProdossimoLopes@users.noreply.github.com> Date: Fri, 16 May 2025 07:25:49 -0300 Subject: [PATCH 2/8] =?UTF-8?q?=F0=9F=92=9A=20use=20correct=20name=20for?= =?UTF-8?q?=20workflow=20job?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_test_packages.yml | 7 +++++++ .github/workflows/swift.yml | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/build_and_test_packages.yml delete mode 100644 .github/workflows/swift.yml diff --git a/.github/workflows/build_and_test_packages.yml b/.github/workflows/build_and_test_packages.yml new file mode 100644 index 0000000..0b8997e --- /dev/null +++ b/.github/workflows/build_and_test_packages.yml @@ -0,0 +1,7 @@ +name: Swift Package Manager + +on: [push, pull_request] + +jobs: + use-reusable: + uses: EasyPackages/.github/.github/workflows/build_and_test_packages.yml@main diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml deleted file mode 100644 index baaa254..0000000 --- a/.github/workflows/swift.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: Swift Package Manager - -on: [push, pull_request] - -jobs: - use-reusable: - uses: EasyPackages/.github/.github/workflows/ci.yml@main From c441ca824b64f617cb4a6fc655382a2cd2f6d1a9 Mon Sep 17 00:00:00 2001 From: Paolo Prodossimo Lopes <70642432+PaoloProdossimoLopes@users.noreply.github.com> Date: Fri, 16 May 2025 07:28:40 -0300 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=92=9A=20fix=20reusable=20workflow=20?= =?UTF-8?q?path?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_test_packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test_packages.yml b/.github/workflows/build_and_test_packages.yml index 0b8997e..2998636 100644 --- a/.github/workflows/build_and_test_packages.yml +++ b/.github/workflows/build_and_test_packages.yml @@ -4,4 +4,4 @@ on: [push, pull_request] jobs: use-reusable: - uses: EasyPackages/.github/.github/workflows/build_and_test_packages.yml@main + uses: .github/.github/workflows/build_and_test_packages.yml@main From 5a087dda99a3b0ddb992bf198078e7cd17a71cfb Mon Sep 17 00:00:00 2001 From: Paolo Prodossimo Lopes <70642432+PaoloProdossimoLopes@users.noreply.github.com> Date: Fri, 16 May 2025 07:36:12 -0300 Subject: [PATCH 4/8] =?UTF-8?q?=F0=9F=92=9A=20make=20rollback=20to=20corre?= =?UTF-8?q?ct=20path?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_test_packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test_packages.yml b/.github/workflows/build_and_test_packages.yml index 2998636..0b8997e 100644 --- a/.github/workflows/build_and_test_packages.yml +++ b/.github/workflows/build_and_test_packages.yml @@ -4,4 +4,4 @@ on: [push, pull_request] jobs: use-reusable: - uses: .github/.github/workflows/build_and_test_packages.yml@main + uses: EasyPackages/.github/.github/workflows/build_and_test_packages.yml@main From cd7d03397810430809d2b1b38813637c6499e0af Mon Sep 17 00:00:00 2001 From: Paolo Prodossimo Lopes <70642432+PaoloProdossimoLopes@users.noreply.github.com> Date: Fri, 16 May 2025 07:59:56 -0300 Subject: [PATCH 5/8] =?UTF-8?q?=F0=9F=92=9A=20remove=20redundant=20executi?= =?UTF-8?q?on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_and_test_packages.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test_packages.yml b/.github/workflows/build_and_test_packages.yml index 0b8997e..d41e712 100644 --- a/.github/workflows/build_and_test_packages.yml +++ b/.github/workflows/build_and_test_packages.yml @@ -1,6 +1,10 @@ name: Swift Package Manager -on: [push, pull_request] +on: + pull_request: + branches: + - main + - develop jobs: use-reusable: From e0e8e4076607495b5ecec4fb1d6e2aa99901c402 Mon Sep 17 00:00:00 2001 From: Paolo Prodossimo Lopes Date: Fri, 16 May 2025 08:09:51 -0300 Subject: [PATCH 6/8] =?UTF-8?q?=E2=9C=85=20fix=20custom=20formatter=20pass?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tests/EasyDateTests/DateExtensionsTests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/EasyDateTests/DateExtensionsTests.swift b/Tests/EasyDateTests/DateExtensionsTests.swift index d9b0bb1..211d7c8 100644 --- a/Tests/EasyDateTests/DateExtensionsTests.swift +++ b/Tests/EasyDateTests/DateExtensionsTests.swift @@ -341,7 +341,7 @@ struct DateExtensionsTests { )! func sut(using formatter: DateFormatter) -> String { - testDate.formatted(using: formatter, timeZone: .gmt) + testDate.formatted(using: formatter, locale: .enUS, timeZone: .gmt) } @Test("iso8601") @@ -377,7 +377,7 @@ struct DateExtensionsTests { @Test("custom pattern") func custom() { let formatter = DateFormatter.custom("MMM yyyy") - #expect(sut(using: formatter) == "mai. 2025") + #expect(sut(using: formatter) == "May 2025") } } From ac83c388f1b5bdfb588c285e7a40b5f64e1ca986 Mon Sep 17 00:00:00 2001 From: Paolo Prodossimo Lopes Date: Fri, 16 May 2025 08:13:33 -0300 Subject: [PATCH 7/8] remove pull request template --- .github/pull_request_template.md | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 18cc628..0000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,21 +0,0 @@ -## Description - -> Briefly describe what this PR does. Focus on the problem solved or the improvement made. - - - -## ✅ Checklist - -> Mark the conditions was full filled - -- [ ] Code was tested locally -- [ ] No magic numbers -- [ ] Documentation updated (if applicable) -- [ ] No comments -- [ ] No force unwraps - -## 🧪 How to Test - -> Describe the steps to test this change. - - \ No newline at end of file From ba8a55b6f5c9bc4c5bf59fe6c5ca14d8b9b11918 Mon Sep 17 00:00:00 2001 From: Paolo Prodossimo Lopes Date: Sun, 18 May 2025 18:18:02 -0300 Subject: [PATCH 8/8] =?UTF-8?q?=E2=9E=95=20add=20easy=20core=20dependency?= =?UTF-8?q?=20to=20remove=20locale=20duplication?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Package.swift | 8 ++- .../EasyDate/DateFormatterExtensions.swift | 5 +- Sources/EasyDate/StringExtensions.swift | 2 +- .../DateFormatterExtensionsTests.swift | 1 + Tests/EasyDateTests/LocaleExtensions.swift | 54 ------------------- 5 files changed, 12 insertions(+), 58 deletions(-) delete mode 100644 Tests/EasyDateTests/LocaleExtensions.swift diff --git a/Package.swift b/Package.swift index 9f2aacf..a14302a 100644 --- a/Package.swift +++ b/Package.swift @@ -7,8 +7,14 @@ let package = Package( products: [ .library(name: "EasyDate", targets: ["EasyDate"]), ], + dependencies: [ + .package( + url: "https://github.com/EasyPackages/EasyCore.git", + .upToNextMajor(from: "0.0.1") + ) + ], targets: [ - .target(name: "EasyDate"), + .target(name: "EasyDate", dependencies: ["EasyCore"]), .testTarget( name: "EasyDateTests", dependencies: ["EasyDate"] diff --git a/Sources/EasyDate/DateFormatterExtensions.swift b/Sources/EasyDate/DateFormatterExtensions.swift index a43ca78..029cb32 100644 --- a/Sources/EasyDate/DateFormatterExtensions.swift +++ b/Sources/EasyDate/DateFormatterExtensions.swift @@ -4,6 +4,7 @@ // import Foundation +import EasyCore /// /// A collection of reusable and localized `DateFormatter` configurations. @@ -30,7 +31,7 @@ public extension DateFormatter { let f = DateFormatter() f.calendar = Calendar(identifier: .iso8601) f.timeZone = .gmt - f.locale = Locale(identifier: "en_US_POSIX") + f.locale = Locale.enUSPOSIX f.dateFormat = "yyyy-MM-dd'T'HH:mm:ssXXXXX" return f } @@ -46,7 +47,7 @@ public extension DateFormatter { /// static var timestamp: DateFormatter { let f = DateFormatter() - f.locale = Locale(identifier: "en_US_POSIX") + f.locale = Locale.enUSPOSIX f.dateFormat = "yyyy-MM-dd HH:mm:ss" return f } diff --git a/Sources/EasyDate/StringExtensions.swift b/Sources/EasyDate/StringExtensions.swift index 88d79c3..b479cf9 100644 --- a/Sources/EasyDate/StringExtensions.swift +++ b/Sources/EasyDate/StringExtensions.swift @@ -106,7 +106,7 @@ public extension String { ] let formatter = DateFormatter() - formatter.locale = Locale(identifier: "en_US_POSIX") + formatter.locale = Locale.enUSPOSIX formatter.timeZone = .gmt for format in formats { diff --git a/Tests/EasyDateTests/DateFormatterExtensionsTests.swift b/Tests/EasyDateTests/DateFormatterExtensionsTests.swift index da42d23..3bad580 100644 --- a/Tests/EasyDateTests/DateFormatterExtensionsTests.swift +++ b/Tests/EasyDateTests/DateFormatterExtensionsTests.swift @@ -1,5 +1,6 @@ import Testing import Foundation +import EasyCore @testable import EasyDate diff --git a/Tests/EasyDateTests/LocaleExtensions.swift b/Tests/EasyDateTests/LocaleExtensions.swift deleted file mode 100644 index a2cc01c..0000000 --- a/Tests/EasyDateTests/LocaleExtensions.swift +++ /dev/null @@ -1,54 +0,0 @@ -import Foundation - -extension Locale { - static let zhCN = Locale(identifier: "zh_CN") - static let zhTW = Locale(identifier: "zh_TW") - static let enUS = Locale(identifier: "en_US") - static let enGB = Locale(identifier: "en_GB") - static let hiIN = Locale(identifier: "hi_IN") - static let esES = Locale(identifier: "es_ES") - static let esMX = Locale(identifier: "es_MX") - static let arEG = Locale(identifier: "ar_EG") - static let arSA = Locale(identifier: "ar_SA") - static let bnBD = Locale(identifier: "bn_BD") - static let bnIN = Locale(identifier: "bn_IN") - static let ptBR = Locale(identifier: "pt_BR") - static let ptPT = Locale(identifier: "pt_PT") - static let ruRU = Locale(identifier: "ru_RU") - static let jaJP = Locale(identifier: "ja_JP") - static let deDE = Locale(identifier: "de_DE") - static let jvID = Locale(identifier: "jv_ID") - static let koKR = Locale(identifier: "ko_KR") - static let frFR = Locale(identifier: "fr_FR") - static let frCA = Locale(identifier: "fr_CA") - static let trTR = Locale(identifier: "tr_TR") - static let viVN = Locale(identifier: "vi_VN") - static let itIT = Locale(identifier: "it_IT") - static let plPL = Locale(identifier: "pl_PL") - static let taIN = Locale(identifier: "ta_IN") - static let mrIN = Locale(identifier: "mr_IN") - static let teIN = Locale(identifier: "te_IN") - static let thTH = Locale(identifier: "th_TH") - static let guIN = Locale(identifier: "gu_IN") - static let urPK = Locale(identifier: "ur_PK") - static let urIN = Locale(identifier: "ur_IN") - static let paIN = Locale(identifier: "pa_IN") - static let faIR = Locale(identifier: "fa_IR") - static let roRO = Locale(identifier: "ro_RO") - static let ukUA = Locale(identifier: "uk_UA") - static let mlIN = Locale(identifier: "ml_IN") - static let knIN = Locale(identifier: "kn_IN") - static let myMM = Locale(identifier: "my_MM") - static let amET = Locale(identifier: "am_ET") - static let orIN = Locale(identifier: "or_IN") - static let azAZ = Locale(identifier: "az_AZ") - static let suID = Locale(identifier: "su_ID") - static let haNG = Locale(identifier: "ha_NG") - static let yoNG = Locale(identifier: "yo_NG") - static let neNP = Locale(identifier: "ne_NP") - static let siLK = Locale(identifier: "si_LK") - static let cebPH = Locale(identifier: "ceb_PH") - static let srRS = Locale(identifier: "sr_RS") - static let svSE = Locale(identifier: "sv_SE") - static let huHU = Locale(identifier: "hu_HU") -}