Skip to content

Commit

Permalink
Fixed incorrect weekday symbols for nongregorian calendars
Browse files Browse the repository at this point in the history
  • Loading branch information
ThasianX committed Sep 22, 2020
1 parent 11267f8 commit c372048
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

import SwiftUI

extension Calendar {

var dayOfWeekInitials: [String] {
weekdaySymbols.map { String($0.first!) }
}

}

extension Calendar {

func endOfDay(for date: Date) -> Date {
Expand Down
4 changes: 1 addition & 3 deletions Sources/ElegantCalendar/Views/Monthly/MonthView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import SwiftUI

fileprivate let daysOfWeekInitials = ["S", "M", "T", "W", "T", "F", "S"]

struct MonthView: View, MonthlyCalendarManagerDirectAccess {

@Environment(\.calendarTheme) var theme: CalendarTheme
Expand Down Expand Up @@ -85,7 +83,7 @@ private extension MonthView {

var daysOfWeekHeader: some View {
HStack(spacing: CalendarConstants.Monthly.gridSpacing) {
ForEach(daysOfWeekInitials, id: \.self) { dayOfWeek in
ForEach(calendar.dayOfWeekInitials, id: \.self) { dayOfWeek in
Text(dayOfWeek)
.font(.caption)
.frame(width: CalendarConstants.Monthly.dayWidth)
Expand Down

0 comments on commit c372048

Please sign in to comment.