Creating Date and time from tiddler date string and parsing oldest created tiddler.

This commit is contained in:
ruidajo 2022-07-12 10:35:43 -05:00
parent f870c0af6f
commit c14e40152e
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,22 @@
Extension { #name : #String }
{ #category : #'*TiddlyWiki' }
String >> asDateAndTimeForTiddler [
| date |
date := OrderedCollection new.
1 to: 4 do: [ :i | date add: (self at: i) ].
date add: '-'.
5 to: 6 do: [ :i | date add: (self at: i) ].
date add: '-'.
7 to: 8 do: [ :i | date add: (self at: i) ].
date add: 'T'.
9 to: 10 do: [ :i | date add: (self at: i) ].
date add: ':'.
11 to: 12 do: [ :i | date add: (self at: i) ].
date add: ':'.
13 to: 14 do: [ :i | date add: (self at: i) ].
date add: '.'.
15 to: 17 do: [ :i | date add: (self at: i) ].
^ (date joinUsing: '') asDateAndTime
]

View File

@ -436,6 +436,15 @@ TiddlyWiki >> networkView [
^ view
]
{ #category : #accessing }
TiddlyWiki >> oldestCreatedTiddler [
| tiddlersTemp oldestDate |
tiddlersTemp := self tiddlers.
oldestDate := (tiddlersTemp collect: [ :tiddler | tiddler created asDateAndTimeForTiddler ]) asSortedCollection first.
^ (tiddlersTemp select:[ :tiddler | tiddler created asDateAndTimeForTiddler = oldestDate ]) first.
]
{ #category : #accessing }
TiddlyWiki >> printOn: aStream [
super printOn: aStream.