tag:blogger.com,1999:blog-7301919772901781969.post6268044569036979873..comments2024-03-27T07:56:45.589-07:00Comments on Noda Time: The joys of date/time arithmeticJon Skeethttp://www.blogger.com/profile/09730219126872960482noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-7301919772901781969.post-90822954453940750822014-04-14T21:58:32.534-07:002014-04-14T21:58:32.534-07:00(Late hit) I wish I'd seen this, uh, over thre...(Late hit) I wish I'd seen this, uh, over three years ago while you were still working on it. I've let myself get entranced by unsolvables too, discontinuities in an algorithm that you'd really, really like to make regular or general. For your ZonedDateTime +/- periods, I think the easiest approach both to explain and implement would have been "if the result from adding/subtracting a period is ambiguous or impossible, use the result from adding/subtracting an equivalent duration". This works for me for your examples of periods expressed in hours/minutes around the DST boundary, and seems to give a result that's usually unsurprising, or at least only momentarily surprising but easily accepted. I haven't thought about leap years yet. Looking forward to learning what you decided as I dig into NodaTime.Anonymoushttps://www.blogger.com/profile/07868410210092281849noreply@blogger.com