File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import Foundation
22
33extension Date {
4- /// Locale-aware date display: "18:30 Feb 25, 2026" (en) or "2026年2月25日 18:30" (zh) .
4+ /// Locale-aware display with a textual month and fixed-width numeric fields .
55 var homeDisplayFormat : String {
6- let formatter = DateFormatter ( )
7- formatter . locale = Locale ( identifier : L10n . shared . resolvedLocaleIdentifier )
8- formatter . dateStyle = . medium
9- formatter . timeStyle = . short
10- return formatter . string ( from : self )
6+ formatted (
7+ Date . FormatStyle (
8+ date : . omitted ,
9+ time : . omitted ,
10+ locale : Locale ( identifier : L10n . shared . resolvedLocaleIdentifier ) ,
11+ )
12+ . year ( . defaultDigits )
13+ . month ( . abbreviated )
14+ . day ( . twoDigits )
15+ . hour ( . twoDigits ( amPM : . abbreviated ) )
16+ . minute ( . twoDigits ) ,
17+ )
1118 }
1219}
Original file line number Diff line number Diff line change @@ -4,23 +4,24 @@ struct NoteCardView: View {
44 let note : Note
55
66 var body : some View {
7- VStack ( alignment : . leading , spacing : 4 ) {
8- HStack {
7+ HStack {
8+ VStack ( alignment : . leading , spacing : 4 ) {
99 Text ( note . title . isEmpty ? " Untitled " : note . title )
1010 . font ( . headline )
1111 . lineLimit ( 1 )
1212
13- Spacer ( )
14-
15- Text ( note . createdAt . homeDisplayFormat )
16- . font ( . caption2 )
17- . foregroundStyle ( . tertiary )
13+ Text ( note . previewText )
14+ . font ( . caption )
15+ . foregroundStyle ( . secondary )
16+ . lineLimit ( 2 )
1817 }
18+ . frame ( maxWidth : . infinity , alignment : . leading )
1919
20- Text ( note . previewText )
21- . font ( . caption )
22- . foregroundStyle ( . secondary )
23- . lineLimit ( 2 )
20+ Text ( note . createdAt . homeDisplayFormat )
21+ . font ( . caption2 )
22+ . monospacedDigit ( )
23+ . foregroundStyle ( . tertiary )
24+ . fixedSize ( )
2425 }
2526 . frame ( maxWidth : . infinity , alignment : . leading )
2627 . padding ( 10 )
Original file line number Diff line number Diff line change @@ -125,10 +125,6 @@ struct PeekContentView: View {
125125 . font ( . body )
126126 . foregroundStyle ( . primary )
127127 . lineLimit ( 1 )
128- Spacer ( )
129- Text ( note . modifiedAt . homeDisplayFormat )
130- . font ( . caption )
131- . foregroundStyle ( . tertiary )
132128 }
133129 if ! note . previewText . isEmpty {
134130 Text ( note . previewText )
@@ -137,6 +133,13 @@ struct PeekContentView: View {
137133 . lineLimit ( 1 )
138134 }
139135 }
136+ . frame ( maxWidth : . infinity , alignment : . leading )
137+
138+ Text ( note . modifiedAt . homeDisplayFormat )
139+ . font ( . caption )
140+ . monospacedDigit ( )
141+ . foregroundStyle ( . tertiary )
142+ . fixedSize ( )
140143 }
141144 . padding ( . horizontal , 16 )
142145 . padding ( . vertical , 8 )
Original file line number Diff line number Diff line change @@ -255,6 +255,7 @@ private struct DateLabelView: View {
255255 HStack ( spacing : 3 ) {
256256 Image ( systemName : systemName )
257257 Text ( date )
258+ . monospacedDigit ( )
258259 }
259260 . font ( . caption )
260261 . foregroundStyle ( . tertiary )
Original file line number Diff line number Diff line change @@ -797,6 +797,7 @@ struct HomeFolderView: View {
797797
798798 Text ( note . modifiedAt . homeDisplayFormat )
799799 . font ( . caption )
800+ . monospacedDigit ( )
800801 . foregroundStyle ( . tertiary )
801802 }
802803 . padding ( . horizontal , 16 )
@@ -894,6 +895,7 @@ struct FolderRowView: View {
894895 if let date {
895896 Text ( date . homeDisplayFormat )
896897 . font ( . caption )
898+ . monospacedDigit ( )
897899 . foregroundStyle ( . tertiary )
898900 }
899901 }
@@ -964,12 +966,6 @@ struct NoteRowView: View {
964966 . font ( . body )
965967 . foregroundStyle ( . primary )
966968 . lineLimit ( 1 )
967-
968- Spacer ( )
969-
970- Text ( note . createdAt . homeDisplayFormat )
971- . font ( . caption )
972- . foregroundStyle ( . tertiary )
973969 }
974970
975971 if ! note . previewText . isEmpty {
@@ -979,6 +975,13 @@ struct NoteRowView: View {
979975 . lineLimit ( 1 )
980976 }
981977 }
978+ . frame ( maxWidth : . infinity , alignment : . leading )
979+
980+ Text ( note . createdAt . homeDisplayFormat )
981+ . font ( . caption )
982+ . monospacedDigit ( )
983+ . foregroundStyle ( . tertiary )
984+ . fixedSize ( )
982985 }
983986 . padding ( . horizontal , 8 )
984987 . padding ( . vertical , 10 )
Original file line number Diff line number Diff line change @@ -242,13 +242,15 @@ struct TrashView: View {
242242 HStack ( spacing : 3 ) {
243243 Image ( systemName : " clock " )
244244 Text ( note . modifiedAt . homeDisplayFormat )
245+ . monospacedDigit ( )
245246 }
246247 . font ( . caption )
247248 . foregroundStyle ( . tertiary )
248249
249250 HStack ( spacing : 3 ) {
250251 Image ( systemName : " calendar " )
251252 Text ( note . createdAt . homeDisplayFormat )
253+ . monospacedDigit ( )
252254 }
253255 . font ( . caption )
254256 . foregroundStyle ( . tertiary )
@@ -567,6 +569,7 @@ private struct TrashedNoteRowView: View {
567569
568570 Text ( note . createdAt . homeDisplayFormat )
569571 . font ( . caption )
572+ . monospacedDigit ( )
570573 . foregroundStyle ( . tertiary )
571574 }
572575
@@ -648,6 +651,7 @@ private struct TrashedFolderRowView: View {
648651
649652 Text ( folder . trashedAt . homeDisplayFormat )
650653 . font ( . caption )
654+ . monospacedDigit ( )
651655 . foregroundStyle ( . tertiary )
652656 }
653657
You can’t perform that action at this time.
0 commit comments