[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[sharing] VSE-S8 TimeStamp

Expression to dump VSE TimeStamp
Stringifier @ TimeStamp current
'{"id":3,"origin":"VSE","contents":{"id":2,"contents":"2018\/12\/17 15:58:41","class":{"id":3,"global":"TimeStamp","allInstVarNames":["date","time"]}}}'

Stringifier @ (TimeStamp date: (Date fromString: '15-12-62') time: (Time hours: 1 minutes: 40 seconds: 0))
'{"id":3,"origin":"VSE","contents":{"id":2,"contents":"1962\/12\/15 1:40:0","class":{"id":3,"global":"TimeStamp","allInstVarNames":["date","time"]}}}'

Reading a TimeStamp instance in VSE

It can be done reading the stringified string in a workspace
(Stringifier @ TimeStamp current) asObjectUploaded Image: ok.gif

Reading a TimeStamp instance in S8

It should instantiate a DateTime instance...
"Testing we get a DateTime"
('{"id":3,"origin":"VSE","contents":{"id":2,"contents":"2018\/12\/17 15:58:41","class":{"id":3,"global":"TimeStamp","allInstVarNames":["date","time"]}}}' asObject isKindOf: DateTime) ifFalse: [self error: 'Must be a DateTime instance' ]


"Testing birthday contents"
| birth |
birth := '{"id":3,"origin":"VSE","contents":{"id":2,"contents":"1962\/12\/15 1:40:0","class":{"id":3,"global":"TimeStamp","allInstVarNames":["date","time"]}}}' asObject.
(birth isKindOf: DateTime) ifFalse: [ self error: 'Must be a DateTime instance' ].
(birth = (DateTime fromString: '1962/12/15 01:40:00')) ifFalse: [
	self error: 'Wrong birthday'
].