Skip to content

Commit be7c3b8

Browse files
committed
Fix month select logic
1 parent c3e627c commit be7c3b8

File tree

10 files changed

+19
-31
lines changed

10 files changed

+19
-31
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Pods/
5858

5959
# Add this line if you want to avoid checking in source code from the Xcode workspace
6060
#
61-
# *.xcworkspace
61+
*.xcworkspace
6262

6363
# Carthage
6464
#

Example/FastisExample.xcodeproj/project.pbxproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
isa = PBXProject;
115115
attributes = {
116116
LastSwiftUpdateCheck = 1140;
117-
LastUpgradeCheck = 1140;
117+
LastUpgradeCheck = 1220;
118118
ORGANIZATIONNAME = "RetailDriver LLC";
119119
TargetAttributes = {
120120
F3FCEE42244780FE000F966E = {
@@ -244,6 +244,7 @@
244244
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
245245
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
246246
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
247+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
247248
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
248249
CLANG_WARN_STRICT_PROTOTYPES = YES;
249250
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -304,6 +305,7 @@
304305
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
305306
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
306307
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
308+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
307309
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
308310
CLANG_WARN_STRICT_PROTOTYPES = YES;
309311
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -340,6 +342,7 @@
340342
CODE_SIGN_STYLE = Automatic;
341343
DEVELOPMENT_TEAM = 48KFD5698Q;
342344
INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist";
345+
IPHONEOS_DEPLOYMENT_TARGET = 14.2;
343346
LD_RUNPATH_SEARCH_PATHS = (
344347
"$(inherited)",
345348
"@executable_path/Frameworks",
@@ -359,6 +362,7 @@
359362
CODE_SIGN_STYLE = Automatic;
360363
DEVELOPMENT_TEAM = 48KFD5698Q;
361364
INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist";
365+
IPHONEOS_DEPLOYMENT_TARGET = 14.2;
362366
LD_RUNPATH_SEARCH_PATHS = (
363367
"$(inherited)",
364368
"@executable_path/Frameworks",

Example/FastisExample.xcworkspace/contents.xcworkspacedata

Lines changed: 0 additions & 10 deletions
This file was deleted.

Example/FastisExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

Lines changed: 0 additions & 8 deletions
This file was deleted.

Example/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
source 'https://github.com/CocoaPods/Specs.git'
1+
source 'https://cdn.cocoapods.org/'
22
platform :ios, '11.0'
33
use_frameworks!
44

Example/Podfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- Fastis (1.0.3):
2+
- Fastis (1.0.12):
33
- JTAppleCalendar (~> 8.0.0)
44
- PrettyCards (~> 1.0.0)
55
- SnapKit (~> 5.0.0)
@@ -11,7 +11,7 @@ DEPENDENCIES:
1111
- Fastis (from `../`)
1212

1313
SPEC REPOS:
14-
https://github.com/CocoaPods/Specs.git:
14+
trunk:
1515
- JTAppleCalendar
1616
- PrettyCards
1717
- SnapKit
@@ -21,11 +21,11 @@ EXTERNAL SOURCES:
2121
:path: "../"
2222

2323
SPEC CHECKSUMS:
24-
Fastis: 329990407f2477b7b5a15fe6ae0f9485350fdd8d
24+
Fastis: f403980b285b38e2930b2473c4c4e3bfbb0e898c
2525
JTAppleCalendar: 932cadea40b1051beab10f67843451d48ba16c99
2626
PrettyCards: 14d7c36a286cbd25ba29d351e9c5473f8c94ca6f
2727
SnapKit: 97b92857e3df3a0c71833cce143274bf6ef8e5eb
2828

29-
PODFILE CHECKSUM: 3ca7a87691df1672969eb39bf0af8564af33681d
29+
PODFILE CHECKSUM: 1535660f8291b9f9d6e4c9762a7e5e6aa4397ec6
3030

31-
COCOAPODS: 1.9.1
31+
COCOAPODS: 1.10.0

Example/Source/ViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ class ViewController: UIViewController {
9999
let fastisController = FastisController(mode: .range)
100100
fastisController.title = "Choose range"
101101
fastisController.initialValue = self.currentValue as? FastisRange
102-
fastisController.minimumDate = Calendar.current.date(byAdding: .month, value: -1, to: Date())
103-
fastisController.maximumDate = Date()
102+
fastisController.minimumDate = Calendar.current.date(byAdding: .month, value: -2, to: Date())
103+
fastisController.maximumDate = Calendar.current.date(byAdding: .month, value: 3, to: Date())
104104
fastisController.allowToChooseNilDate = true
105105
fastisController.shortcuts = [.today, .lastWeek, .lastMonth]
106106
fastisController.doneHandler = { newValue in

Source/Extensions/Date + Utilits.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Foundation
1111
extension Date {
1212

1313
internal func startOfMonth(in calendar: Calendar = .current) -> Date {
14-
return calendar.date(from: calendar.dateComponents([.year, .month], from: calendar.startOfDay(for: self)))!
14+
return calendar.date(from: calendar.dateComponents([.year, .month], from: calendar.startOfDay(for: self)))!.startOfDay(in: calendar)
1515
}
1616

1717
internal func endOfMonth(in calendar: Calendar = .current) -> Date {

Source/Views/Controller.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ public class FastisController<Value: FastisValue>: UIViewController, JTACMonthVi
432432
if self.privateSelectMonthOnHeaderTap, Value.mode == .range {
433433
header.tapHandler = {
434434
var fromDate = range.start.startOfMonth(in: self.currentCalendar)
435-
var toDate = range.end.endOfMonth(in: self.currentCalendar)
435+
var toDate = range.start.endOfMonth(in: self.currentCalendar)
436436
if let minDate = self.minimumDate {
437437
if toDate < minDate { return }
438438
else if fromDate < minDate {

Source/Views/DayCell.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ class DayCell: JTACDayCell {
8989
if let cornerRadius = config.customSelectionViewCornerRadius {
9090
self.selectionBackgroundView.layer.cornerRadius = cornerRadius
9191
}
92-
rangedBackgroundViewTopBootomConstraints.map{ $0.update(inset: config.rangedBackgroundViewInset)}
92+
self.rangedBackgroundViewTopBootomConstraints.forEach({
93+
$0.update(inset: config.rangedBackgroundViewInset)
94+
})
9395
}
9496

9597
public func configureSubviews() {

0 commit comments

Comments
 (0)