Closed ivanskodje closed 5 years ago
Since the days per month every year appear to change arbitrarily.
They may have been chosen arbitrarily but, except for February in leap years, the amount of days in the month don't change.
As a side note, such a calendar could be based on a general purpose Date object to manipulate time. There is no such thing in Godot yet, only a bunch of functions in OS returning floats, ints or dictionaries. I think it has been mentionned already on Github but I can't find when :/
some games may require entering birth date upon registration, +editor can benefit from it at some point (date editor popup)
Even basic Date/DateTime & TimeDelta (that is, we should be able to do basic math with Date/DateTime objects) objects would be useful, then a calendar would pretty much be super easy to implement ourselves. Python anyone? :)
Calendar object/node is one thing, Date/DateTime/TimeDelta operations is another IMHO.
I think we could just expose to Godot the functions which are available in C's standard lib (time.h) and later maybe add some extra functions to that.
https://en.wikipedia.org/wiki/C_date_and_time_functions
EDIT: Remember that parts of this are already done, we have get_date() and get_datetime() functions in OS class. The missing parts are functions which help doing math on date and time and, in practice, a DateTime object/structure/variant.
I thought you are referring to fantasy calendar object https://donjon.bin.sh/fantasy/calendar/
I noticed I wrote "Calendar", but I meant more of a "Date" or "Datetime" class. Having one exclusively for a Calendar might be a bit niche... :) Editing title
Also, I have solved the need for this (at least until a better solution comes up): https://github.com/Tybobobo/godot-plugin-calendar-button
Once it get approved, it should also appear on AssetLib: https://godotengine.org/asset-library/asset/22
Unfortunately this plugin seems no longer compatible with the new Godot...
When it comes to things like time, things get complicated, so it's best to use an external library. This could probably be added with a GDNative library that integrates a time library with Godot to allow for calculations and calendars and such. However, I don't think that calculating dates and times is a common enough problem for games to be worth including in Godot.
I agreed with @aaronfranke - You can always write your own calendar manually using helper functions such as OS.get_datetime + its better to be a separate module cuz Its not a game specific functionality, so closed
Godot is currently missing a class (or even functions) that allows you to setup your own calendar.
I would like to be able to use a Date/Datetime class to determine number of days in X month and Y year. Since the days per month every year appear to change arbitrarily, I expect a lot of users may find need of this.
I know a these classes can be used for a lot more, than to simply print out days and such, so I would also love to see it being worked on for other common purposes. Heck; most, if not all programming languages have a Date class accompanied with an Datetime class. All we have right now is a Dictionary with "day", "hour" and such. :)
I made an question at QA; https://godotengine.org/qa/7923/a-calendar-class-or-feature-i-can-use where I suggested we also may create an calendar node button, that allows us to simply select a day/month/year from a popup.