Re: Date time classes for new Wonder frameworks
Re: Date time classes for new Wonder frameworks
- Subject: Re: Date time classes for new Wonder frameworks
- From: Q <email@hidden>
- Date: Thu, 25 Oct 2012 13:13:54 +1000
On 20/10/2012, at 10:50 AM, Pascal Robert <email@hidden> wrote:
>
> Le 2012-10-19 à 20:04, Paul Hoadley <email@hidden> a écrit :
>
>> On 20/10/2012, at 9:21 AM, Pascal Robert <email@hidden> wrote:
>>
>>> I'm working on ERGroupware, and I was wondering if I should use NSTimestamp. I started using it to make it more "WO friendly" but I have to fu**ing convert everything because the dates for ical4j, Zimbra and MS Exchange expect a java.util.Date or java.util.Calendar, hence the need to create or convert NSTimestamp.
>>>
>>> So the question: for new frameworks that will go in Wonder, should we keep using NSTimestamp or should we use something else?
>>
>> If you're talking about code internal to your new framework, then presumably it doesn't matter. But if it's code that's going to interface with existing frameworks, aren't you creating an interoperability problem given that every existing framework uses NSTimestamp? What am I missing here?
>
> It's mainly « external ». The thing is that I have classes that regroup all attributes of a iCalendar file, an appointment or task in Zimbra (SOAP API) or Exchange Web Services. Of source, those 3 sources use different date time classes… And I end up with things like:
>
> NSTimestamp eventStartDate = event.startTime();
> Calendar startDate = GregorianCalendar.getInstance();
> startDate.setTime(eventStartDate);
> calendarItem.setStart(startDate);
Or you could write:
calendarItem.setStart(ERXTimestampUtility.calendarForTimestamp(event.startTime()));
> But the question is mainly about if we should move away from NSTimestamp in new frameworks for Wonder, or should we move to something else, for « exposed » date time attributes (that is, attributes that would be editable in a WOTextField, by REST, etc.).
If the data is a timestamp, use NSTimestamp. If it's a date with an expected chronology and timezone, use something more appropriate. For my own code when handling dates I use a custom class that subclasses NSTimestamp but uses joda internally and exposes most of the joda DateTime API for date & time handling operations.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden