Creating Date and time from tiddler date string and parsing oldest created tiddler.
This commit is contained in:
parent
f870c0af6f
commit
c14e40152e
22
repository/TiddlyWiki/String.extension.st
Normal file
22
repository/TiddlyWiki/String.extension.st
Normal 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
|
||||
]
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user