weixin_39588252 2020-11-29 22:59
浏览 0

Storing and retrieving future dates and times

Given the purpose of this library it occurs to me that there's something else you could try to help users with: storing and retrieving future date-time values.

To motivate, I'll refer to this post:

which recommends that developers "preserve local time, using UTC as derived data to be recomputed" in specific use-cases. (There's HackerNews discussion here; one of the comments points to RFC5545. In particular, take a look at section 3.3.5.)

What I'm thinking is that this library could a) enumerate the different kinds of storage, different kinds of trade-offs; and b) provide appropriate encodings/decodings. Bonus points if the encodings/decodings aren't jut BLOBs—e.g., if they work well in CoreData, JSON, etc.!

该提问来源于开源项目:davedelong/time

  • 写回答

6条回答 默认 最新

  • weixin_39588252 2020-11-29 22:59
    关注

    RFC5545 Section 3.3.5 mentions three kinds of time:

    • FORM 1: DATE WITH LOCAL TIME
    • FORM 2: DATE WITH UTC TIME
    • FORM 3: DATE WITH LOCAL TIME AND TIME ZONE REFERENCE

    It looks like Apple's Reminders app uses FORM 1, and Apple's Calendar app uses FORM 3. (Not surprising, just noting.)

    Based on light testing, I think the Reminders and Calendar apps also record the calendar of the date and time; if I create entries and change calendars the entries continue to make sense. They don't, for example, assume the entry was referring to the year 2020 in the newly selected calendar.

    In RFC5545 a calendar is called a "Calendar Scale." Calendar Scales are described in section 3.7.1.

    评论

报告相同问题?