Skip to content

Commit

Permalink
If date is today, use today instead of todays date v2
Browse files Browse the repository at this point in the history
  • Loading branch information
feliciaan committed Nov 26, 2015
1 parent 1a0dc5a commit c106de1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion iOS/Hydra/HomeActivityCollectionViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,19 @@ class HomeActivityCollectionViewCell: UICollectionViewCell {
titleLabel.text = activity?.title
dateEndFormatter.dateFormat = "H:mm";

if (self.activity!.end != nil) {
if (self.activity!.start.isToday()) {
if self.activity!.start.dateByAddingDays(1).isLaterThanDate(self.activity!.end) {
dateLabel.text = "vandaag \(dateEndFormatter.stringFromDate((self.activity?.start)!)) - \(dateEndFormatter.stringFromDate((self.activity?.end)!))"
} else {
dateLabel.text = "vandaag \(dateEndFormatter.stringFromDate((self.activity?.start)!)) - \(dateStartFormatter.stringFromDate((self.activity?.end)!))"
}
} else if (self.activity!.start.isTomorrow()) {
if self.activity!.start.dateByAddingDays(1).isLaterThanDate(self.activity!.end) {
dateLabel.text = "morgen \(dateEndFormatter.stringFromDate((self.activity?.start)!)) - \(dateEndFormatter.stringFromDate((self.activity?.end)!))"
} else {
dateLabel.text = "morgen \(dateEndFormatter.stringFromDate((self.activity?.start)!)) - \(dateStartFormatter.stringFromDate((self.activity?.end)!))"
}
} else if (self.activity!.end != nil) {
if self.activity!.start.dateByAddingDays(1).isLaterThanDate(self.activity!.end) {
dateLabel.text = "\(dateStartFormatter.stringFromDate((self.activity?.start)!)) - \(dateEndFormatter.stringFromDate((self.activity?.end)!))"
} else {
Expand Down

0 comments on commit c106de1

Please sign in to comment.