In my WidgetKit course we build a calendar widget where we build our own calendar using date math. You can learn more here - seanallen.teachable.com/p/widgets
I was super excited when saw this new Formatter API, but it still restriction formatting dates inside the widget Text(Date, style: .timer). Is there a way to get around this limitation?
Sean, nice explanation - this video has cleared up - ONE aspect of Date/Time in Swift for me... but, I still need a "2022-03-24" style date (no time) for an API and cannot figure a way with Date.FormatStyle. If I try iso8601 I get the proper Y-M-D but also the time printed out. I'm not seeing a way to suppress time in this case. I was reading very closely the Apple Docs - the order of the components is NOT specified by the Style struct. I think the ordering is controlled by Locale. But I can't bend the FormatStyle to my will.... Any tips? Help!
What I haven’t figured-out yet is how to change the order of the date elements to: weekday day month year (without commas)… as it keeps defaulting to: weekday, month day, year(with commas). Thanks for the video!
The Apple Docs have a sentence about the fact that the order of the Date is dependent upon your Locale! In Date.FormatStyle: "The ordering of the date and time modifiers has no impact on the string produced." Yet in some fashion you can set the Locale to order the components differently. I'm still trying to understand this!
Been using Swift on the server, I hope this feature worked on Linux because the old .toISO8601 doesn't work on Linux for some reason. Update: Sadly for some reason, it does not exist when compiled on Linux-based machines including Docker environments. Still a great thing to have for iOS development though
That ISO date format is the only format any self-respecting IT person should *EVER* use. All other date formats were standardized by our ancestors before computers ever existed - and they made poor choices. Sure - display the date to users in the format they like - but if you write a log file or include the date in a file name - it should always be in that YYMMDD ISO format. I work for a software company with Americans, Europeans and Indians - and the Americans are always pushing the date format they grew up with as the one that “should” be used and should be the default - but objectively, it is the absolute WORST of all the competing formats. When YYMMDD is used, there is absolutely no ambiguity possible - and things sorry nicely - but in MDY or DMY format - it’s often impossible to tell which format it “actually” is in unless you are told. 🤦🏻♂️ If you’re given a single document - created within the first 12 days of a month - and no context - you can’t know for sure whether it was created on Nov 2nd or Feb 11th. Seriously - that system should be universally forgotten and it should be made a criminal offence (with mandatory jail time) for anyone to ever even mention it again. It’s horrible. It’s just the worst. 🙄
If you like my teaching style - I have iOS Developer courses at seanallen.teachable.com/
Been using this but your extension really cleans up the view and moves that logic out of they way. Nice looking call-site as well!
I love me a nice and clean call site 😀
Learned all my refactoring and code cleaning from you!
Plus, extensions are very powerful
Happy to hear that, Jaylen. All the best! 😀
Great content! You used to be my go-to, Happy to see you back with these!
Much more to come, Dre!
@@seanallen What I was hoping you'd say! Looking forward to it :)
Seeing you after long time Sean, Great explanation as usual.
More of these on these on the way, Siva!
Great!! Exaclty what I was looking for!
Glad I could help, Caio!
Please make more videos like these
More to come, Donat 🚀
Super handy thanks sean 👌
Happy to help, Vamsi.
Great video as always. Do any of you courses go over real life use cases of Calendar?
In my WidgetKit course we build a calendar widget where we build our own calendar using date math. You can learn more here - seanallen.teachable.com/p/widgets
super helpful thx
Glad it helped
I was super excited when saw this new Formatter API, but it still restriction formatting dates inside the widget Text(Date, style: .timer). Is there a way to get around this limitation?
Great vid! More of this =)
More to come, Bobby 🚀
Can it just show just the weekday only? Like Mon Tue Wed, etc.
Thank you!!!!!!
Sean, nice explanation - this video has cleared up - ONE aspect of Date/Time in Swift for me... but, I still need a "2022-03-24" style date (no time) for an API and cannot figure a way with Date.FormatStyle. If I try iso8601 I get the proper Y-M-D but also the time printed out. I'm not seeing a way to suppress time in this case.
I was reading very closely the Apple Docs - the order of the components is NOT specified by the Style struct. I think the ordering is controlled by Locale.
But I can't bend the FormatStyle to my will.... Any tips? Help!
What I haven’t figured-out yet is how to change the order of the date elements to: weekday day month year (without commas)… as it keeps defaulting to: weekday, month day, year(with commas).
Thanks for the video!
The Apple Docs have a sentence about the fact that the order of the Date is dependent upon your Locale!
In Date.FormatStyle: "The ordering of the date and time modifiers has no impact on the string produced."
Yet in some fashion you can set the Locale to order the components differently. I'm still trying to understand this!
Awesome 👏🏻
Thanks 🤗
wow... still no spoken format for VoiceOver / a11y
Does it take into account the phone's locale, language, etc...?
Yes, that is strong reason to use these vs. the old way
Much easier now
Yup. I'm a HUGE fan.
Can I do dd-MM-yyyy?
I don't know of the top of my head. You'd have to play around with the customization to find out.
@@seanallen I tried and couldn’t figure it out. Guess I’m stuck with date formatter for now 🤷🏾♂️
it looks like I will keep using dateFormatter for custom date formats.
Been using Swift on the server, I hope this feature worked on Linux because the old .toISO8601 doesn't work on Linux for some reason.
Update: Sadly for some reason, it does not exist when compiled on Linux-based machines including Docker environments. Still a great thing to have for iOS development though
DateFormatter I've loved you. But . . . I have found another. Yes, it's Date().formatted, how did you know?
All good things come to an end 😀
DAM.....
That ISO date format is the only format any self-respecting IT person should *EVER* use. All other date formats were standardized by our ancestors before computers ever existed - and they made poor choices. Sure - display the date to users in the format they like - but if you write a log file or include the date in a file name - it should always be in that YYMMDD ISO format.
I work for a software company with Americans, Europeans and Indians - and the Americans are always pushing the date format they grew up with as the one that “should” be used and should be the default - but objectively, it is the absolute WORST of all the competing formats. When YYMMDD is used, there is absolutely no ambiguity possible - and things sorry nicely - but in MDY or DMY format - it’s often impossible to tell which format it “actually” is in unless you are told. 🤦🏻♂️ If you’re given a single document - created within the first 12 days of a month - and no context - you can’t know for sure whether it was created on Nov 2nd or Feb 11th. Seriously - that system should be universally forgotten and it should be made a criminal offence (with mandatory jail time) for anyone to ever even mention it again. It’s horrible. It’s just the worst. 🙄
Nicely held opinion. Just for argument's sake - I suggest YYYY-MM-DD .iso8601 style.
You literally answered the question I had as I was typing it; ISO8601 for the win 😁
It's a nice little addition, that's for sure.