what you say is correct if dealing with one month ago - but lets now imagine it is say 31 may and we wish to go back 2, 3 or 4 months - where should we end up??
On Friday, 20 September 2019 15:33:24 UTC+3, Greg Troxel wrote: > > Thomas Keffer <[email protected] <javascript:>> writes: > > > Damn. I just realized we have the same problem with years. Quick, what > is > > 2016-02-29 minus one year? > > One good answer is 2015-03-01, and another is 2015-02-28. I prefer 3/1. > > > > I would suggest stepping back and asking why we do these calculations, > hat answers are sensible/useful, and what properties the calculations > need. > > I saw a notion that this basic math property should hold > > one_month_after( one_month_before(X) ) = X > > but I'm not sure that's a requirement. The math nerd in me can > certainly see the appeal, but also that our calendar doesn't work that > way. > > If someone wants to make a graph over "a month ago to now", or ask "what > was the low temperature over the last month" on some particular day, > that's a reasonable question. I think it's just as reasonable a > question to ask as "over the last 30 days" or "over the last 29.57 days". > > I think it's reasonable to take Y-M-D and subtract one month, and then > move forward if that's invalid, so > > 2019-01-15 => 2018-12-15 > 2019-03-28 => 2019-02-28 > 2019-03-29 => 2019-03-01 > 2019-03-30 => 2019-03-01 > 2019-03-31 => 2019-03-01 > 2019-04-01 => 2019-03-01 > > and so be it. Yes, the time interval between these pairs varies - but > our months do have different lengths. Humans don't expect to be able to > say "what was the date a month ago" and then "on that date, what's a > month in the future" and get the same date. Humans also don't expect a > fixed answer to "between a month ago and now, how many days are there". > > If people want to ask the question "30 days ago", that's fine, and they > should be able to do that instead. > -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/9b7ac379-3019-483c-be24-b732da7ecf22%40googlegroups.com.
