Hello,

When using NSDateFormatter for relative date formatting, I am getting the 
localised word for today capitalised in some locales not not all. Is this 
expected behaviour?  I’ve tried to research this and it seems the word today 
shouldn’t be capitalised (in English at least...) unless it’s used in a title, 
if true, then is this a bug in NSDateFormatter?

I want to tell the user something is free until a certain time, in my example 
I’m always saying it’s free until in 2 minutes time. Consider the following 
code:

import Foundation

let formatter = DateFormatter()
formatter.timeStyle = .short
formatter.dateStyle = .short
formatter.doesRelativeDateFormatting = true
formatter.locale = Locale(identifier: "en_GB")

"Free until \(formatter.string(from: Date(timeIntervalSinceNow: 120)))"

The problem is that by using doesRelativeDateFormatting on my date formatter, 
I’m relying on it to get the correct word for yesterday, today or tomorrow. And 
it seems that in a mix of locales this is capitalised. For example:

en_GB:
Free until Today, 08:52

es_ES:
Free until hoy 8:54

pt_BR:
Free until Hoje, 08:54

fr_FR:
Free until aujourd’hui 08:54


Any ideas and input welcome,

Thanks,
Daniel
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to