diff --git a/submodules/DatePickerNode/Sources/DatePickerNode.swift b/submodules/DatePickerNode/Sources/DatePickerNode.swift index 44c5ca42c4..e28943df0f 100644 --- a/submodules/DatePickerNode/Sources/DatePickerNode.swift +++ b/submodules/DatePickerNode/Sources/DatePickerNode.swift @@ -818,7 +818,7 @@ public final class DatePickerNode: ASDisplayNode { timeSize.height = 36.0 self.timeButtonNode.frame = CGRect(x: size.width - timeSize.width - 4.0, y: 4.0, width: timeSize.width, height: timeSize.height) - let dateString = stringForDate(date: date, timeZone: .current, strings: self.strings) + let dateString = stringForMediumDate(timestamp: Int32(date.timeIntervalSince1970), strings: self.strings, dateTimeFormat: self.dateTimeFormat, withTime: false) self.dateButtonNode.setTitle(dateString, with: Font.with(size: 17.0, traits: .monospacedNumbers), with: self.state.displayingDateSelection ? self.theme.accentColor : self.theme.textColor, for: .normal) var dateSize = self.dateButtonNode.measure(size) diff --git a/submodules/PremiumUI/Sources/CreateGiveawayController.swift b/submodules/PremiumUI/Sources/CreateGiveawayController.swift index 5184c8437f..96dbded069 100644 --- a/submodules/PremiumUI/Sources/CreateGiveawayController.swift +++ b/submodules/PremiumUI/Sources/CreateGiveawayController.swift @@ -719,7 +719,7 @@ public func createGiveawayController(context: AccountContext, updatedPresentatio let expiryDate = calendar.date(byAdding: .day, value: 3, to: calendar.date(from: components)!)! let expiryTime = Int32(expiryDate.timeIntervalSince1970) - let minDate = currentTime + 60 * 10 + let minDate = currentTime + 60 * 30 let maxDate = currentTime + context.userLimits.maxGiveawayPeriodSeconds let initialState: CreateGiveawayControllerState = CreateGiveawayControllerState(mode: .giveaway, subscriptions: initialSubscriptions, channels: [], peers: [], countries: [], onlyNewEligible: false, time: expiryTime) diff --git a/submodules/TelegramStringFormatting/Sources/DateFormat.swift b/submodules/TelegramStringFormatting/Sources/DateFormat.swift index ac65710077..27479dca88 100644 --- a/submodules/TelegramStringFormatting/Sources/DateFormat.swift +++ b/submodules/TelegramStringFormatting/Sources/DateFormat.swift @@ -50,7 +50,7 @@ public func getDateTimeComponents(timestamp: Int32) -> (day: Int32, month: Int32 return (timeinfo.tm_mday, timeinfo.tm_mon + 1, timeinfo.tm_year, timeinfo.tm_hour, timeinfo.tm_min) } -public func stringForMediumDate(timestamp: Int32, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat) -> String { +public func stringForMediumDate(timestamp: Int32, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, withTime: Bool = true) -> String { var t: time_t = Int(timestamp) var timeinfo = tm() localtime_r(&t, &timeinfo); @@ -70,9 +70,12 @@ public func stringForMediumDate(timestamp: Int32, strings: PresentationStrings, dateString = String(format: "%02d%@%02d%@%02d%@", day, separator, month, separator, displayYear, suffix) } - let timeString = stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat) - - return strings.Time_MediumDate(dateString, timeString).string + if withTime { + let timeString = stringForShortTimestamp(hours: Int32(timeinfo.tm_hour), minutes: Int32(timeinfo.tm_min), dateTimeFormat: dateTimeFormat) + return strings.Time_MediumDate(dateString, timeString).string + } else { + return dateString + } } public func stringForFullDate(timestamp: Int32, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat) -> String {