diff --git a/AppleLibs.xcodeproj/project.pbxproj b/AppleLibs.xcodeproj/project.pbxproj index 258563d0b555034ce78d802cc22a8143dcbb37a1..d0453a632fd056b647941f941a321a54e8fe0df1 100644 --- a/AppleLibs.xcodeproj/project.pbxproj +++ b/AppleLibs.xcodeproj/project.pbxproj @@ -31,6 +31,7 @@ F6A251A7260B670000132DEC /* AppleLibs.h in Headers */ = {isa = PBXBuildFile; fileRef = F6A25199260B66FF00132DEC /* AppleLibs.h */; settings = {ATTRIBUTES = (Public, ); }; }; F6A251BA260B697300132DEC /* Double+Rounded.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6A251B9260B697300132DEC /* Double+Rounded.swift */; }; F6A251BE260B699100132DEC /* String+Html.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6A251BD260B699100132DEC /* String+Html.swift */; }; + F6A70E14275D445300C2FB00 /* Date+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6A70E13275D445300C2FB00 /* Date+Create.swift */; }; F6CD575026D246470051B38E /* Float+Rounded.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6CD574F26D246470051B38E /* Float+Rounded.swift */; }; /* End PBXBuildFile section */ @@ -72,6 +73,7 @@ F6A251B2260B680F00132DEC /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = "<group>"; }; F6A251B9260B697300132DEC /* Double+Rounded.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Double+Rounded.swift"; sourceTree = "<group>"; }; F6A251BD260B699100132DEC /* String+Html.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Html.swift"; sourceTree = "<group>"; }; + F6A70E13275D445300C2FB00 /* Date+Create.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Create.swift"; sourceTree = "<group>"; }; F6CD574F26D246470051B38E /* Float+Rounded.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Float+Rounded.swift"; sourceTree = "<group>"; }; /* End PBXFileReference section */ @@ -163,6 +165,7 @@ children = ( F68C2D412616482A00042967 /* IsoDateFormatter.swift */, F623A67A2635B5F900F50371 /* Date+Styled.swift */, + F6A70E13275D445300C2FB00 /* Date+Create.swift */, ); path = Date; sourceTree = "<group>"; @@ -353,6 +356,7 @@ F623A6742635B5BE00F50371 /* Enum+Extended.swift in Sources */, F673A9962635EF510017AD37 /* ResponseError.swift in Sources */, F673A9992635EF510017AD37 /* RequestBuilder.swift in Sources */, + F6A70E14275D445300C2FB00 /* Date+Create.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/AppleLibs/Utils/Date/Date+Create.swift b/AppleLibs/Utils/Date/Date+Create.swift new file mode 100644 index 0000000000000000000000000000000000000000..f0b2fc76d5db9248c89dafbbb33dcbbb9b1b0d7b --- /dev/null +++ b/AppleLibs/Utils/Date/Date+Create.swift @@ -0,0 +1,19 @@ +// +// Date+Create.swift +// AppleLibs +// +// Created by Tobias on 05.12.21. +// + +import Foundation + +public extension Date +{ + static func from(year: Int, month: Int, day: Int, hours: Int = 0, minutes: Int = 0, soconds: Int = 0, timezone: TimeZone = TimeZone.current) -> Date + { + var calendar = Calendar(identifier: .gregorian) + calendar.timeZone = timezone + let components = DateComponents(year: year, month: month, day: day, hour: hours, minute: minutes, second: soconds) + return calendar.date(from: components)! + } +}