Last active
March 15, 2024 13:11
Revisions
-
StewartLynch revised this gist
Jan 22, 2024 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ static var capitalizedFirstLettersOfWeekdays: [String] { let calendar = Calendar.current let weekdays = calendar.shortWeekdaySymbols @@ -8,7 +9,7 @@ } } static var fullMonthNames: [String] { let dateFormatter = DateFormatter() dateFormatter.locale = Locale.current -
StewartLynch created this gist
Jan 21, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ static func capitalizedFirstLettersOfWeekdays() -> [String] { let calendar = Calendar.current let weekdays = calendar.shortWeekdaySymbols return weekdays.map { weekday in guard let firstLetter = weekday.first else { return "" } return String(firstLetter).capitalized } } static func fullMonthNames() -> [String] { let dateFormatter = DateFormatter() dateFormatter.locale = Locale.current return (1...12).compactMap { month in dateFormatter.setLocalizedDateFormatFromTemplate("MMMM") let date = Calendar.current.date(from: DateComponents(year: 2000, month: month, day: 1)) return date.map { dateFormatter.string(from: $0) } } }