flips icon indicating copy to clipboard operation
flips copied to clipboard

FLIP 251: Cadence Date and Time

Open darkdrag00nv2 opened this issue 1 year ago • 6 comments

https://github.com/onflow/flips/issues/251

Work towards https://github.com/onflow/cadence/issues/843

darkdrag00nv2 avatar Jan 29 '24 17:01 darkdrag00nv2

cc: @turbolent @SupunS @dsainati1

darkdrag00nv2 avatar Feb 04 '24 13:02 darkdrag00nv2

It is assumed that there are 3600*24 seconds in every day and there are no leap years.

I think ignoring leap years is not a good idea.

bluesign avatar Feb 19 '24 14:02 bluesign

It is assumed that there are 3600*24 seconds in every day and there are no leap years.

I think ignoring leap years is not a good idea.

Agreed, we can probably at least support leap years, like e.g. Java's java.time.LocalDate does.

In general, we should not reinvent the wheel here and base the API and implementation of an established solution, like e.g. Java's JSR310

turbolent avatar Feb 19 '24 22:02 turbolent

In general, we should not reinvent the wheel here and base the API and implementation of an established solution, like e.g. Java's JSR310

Yep, the current proposal is more based on the python datetime module.

I wrongly made the assumption that they don't support leap years :slightly_frowning_face:. I was just giving the wrong input with the year 2011 :facepalm:

>>> datetime.datetime(2011, 2, 29)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: day is out of range for month

Trying with an actual leap year works fine.

>>> datetime.datetime(2024, 2, 29)

darkdrag00nv2 avatar Feb 20 '24 07:02 darkdrag00nv2

Hi @darkdrag00nv2 - this FLIP is not reflected on FLIP project tracker. Did you follow the process outlined in https://github.com/onflow/flips? Specifically please remember to do the following without which the FLIP won't get visibility on the project tracker-

Create an issue by using one of the FLIP issue templates based on the type of the FLIP - application, governance, cadence or protocol. The title of the issue should be the title of your FLIP, e.g., "Dynamic Inclusion fees". Submit the issue. Note the issue number that gets assigned. Then, create your FLIP as a pull request to this repository (onflow/flips). Use the issue number generated in step 2 as the FLIP number. And mention the FLIP issue by copying the GitHub URL or the issue in the comment section.

Thank you!

KshitijChaudhary666 avatar Feb 28 '24 22:02 KshitijChaudhary666

We had a working group call yesterday and discussed this FLIP, see the notes in https://github.com/onflow/Flow-Working-Groups/blob/main/cadence_language_and_execution_working_group/meetings/2024-10-29.md#flips.

Consensus is that the proposed library would be useful, but is low priority. Luckily it can be implemented purely in Cadence, and does not need any knowledge of or required any contributions to the Cadence implementation.

@onflow/flow-develop-experience-tools @gregsantos: @dete proposed this could be a good item for the community and could e.g. be implemented through a grant, at a hackathon, etc.

turbolent avatar Oct 30 '24 20:10 turbolent