Is there a way to present partial dates in Noda Time?

I am trying to present a company based date in C #. I sometimes have a whole day, a month and a year, but most often I only have a month and a year, and sometimes one year.

Is there a way that I can present this in NodaTime, in such a way as to enable the comparison between the two then as well? those. 2012 < June 2013 == truebut 2013 < June 2013 == falsebecause it is the same year.

I also need to be able to uniquely retrieve stored data. What I have in mind, unequivocally, is that I cannot store 2013how 1/1/2013, because I could not get the information that I know only for the date 2013.

+4
source share
1 answer

To answer the question: no, there is no Noda Time type that you can use to directly represent the concept of "year" or "year and month."

(Well, for the sake of completeness, I should note that you could probably use Period, but I think it would be rather difficult to use calendar duration to represent the date and somewhat abuse what is Periodintended to be used.)

, , , , Noda Time LocalDate ( "2013 " 2013-01-01) , , (.. Year, YearMonth YearMonthDay), IComparer<MyPartialLocalDate>, ( LocalDate, , , , ).

+2

Source: https://habr.com/ru/post/1540692/


All Articles