...... or compromise, and define 'month' = 30 days in weewxese perhaps.
On Thursday, 19 September 2019 17:39:47 UTC+3, Thomas Keffer wrote: > > I guess I'm queasy at the thought of a solution that simply does not raise > an error. It should obey some basic laws of math. For example, subtracting > a month, then adding it back on should yield the same date. This solution > would not. > > I'm in favor of eliminating month arithmetic. It doesn't add anything. > > Alternatively, we could leave it in, but require the user to catch any > exceptions, then make up his/her mind what the semantics should be. > > -tk > > On Thu, Sep 19, 2019 at 6:25 AM mph <[email protected] <javascript:>> > wrote: > >> Hi all, >> >> the primary requirement is: „Do not generate errors on month_delta >> mathematics“ >> >> The implementation and thus resulting date is not so important, I think. >> >> So if we will implement any error-free logic, then everything will be ok. >> >> >> >> In my opinion, if the user has date say Mar 10th, or 03/10 and wants to >> subtract one month, it just wants to do MM=03-1 -> 02/10. If the formula >> generates invalid date (03/31 -> 02/31) then we should offer a valid date, >> e.g. 02/28. Nothing more special. >> For general use the implementation of any existing logic (bash) should be >> acceptable. >> >> Thank you >> >> Pavel >> >> >> Dne čtvrtek 19. září 2019 15:00:20 UTC+2 Thomas Keffer napsal(a): >>> >>> On Wed, Sep 18, 2019 at 11:37 PM gjr80 <[email protected]> wrote: >>> >>>> That aside, whether you call it a bug or not I don't think we should >>>> have a tag that when you give it an allowed value/parameter it aborts the >>>> template. >>>> >>> >>> We don't. The tag that caused the error was user-supplied. >>> >>> From Graham's experiments, it looks like sqlite and bash simply subtract >>> four weeks. The span tag can already do that, so if that's what the >>> user wants, s/he can just specify it. >>> >>> As for Python, it doesn't even offer month arithmetic (at least, through >>> class datetime.timedelta), probably for the reasons we have discovered. >>> I'm thinking we should do the same. >>> >>> -tk >>> >>> >> -- >> 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] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/weewx-user/36ad9d07-b295-4733-b0b2-44c9437133cd%40googlegroups.com >> >> <https://groups.google.com/d/msgid/weewx-user/36ad9d07-b295-4733-b0b2-44c9437133cd%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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/9df7a851-5ec6-43c3-8231-4d6f06364a58%40googlegroups.com.
