onflow / flips

Flow Improvement Proposals
24 stars 22 forks source link

FLIP 251: Cadence Date and Time #245

Open darkdrag00nv2 opened 5 months ago

darkdrag00nv2 commented 5 months ago

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

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

darkdrag00nv2 commented 5 months ago

cc: @turbolent @SupunS @dsainati1

bluesign commented 4 months ago

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.

turbolent commented 4 months ago

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

darkdrag00nv2 commented 4 months ago

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)
KshitijChaudhary666 commented 4 months ago

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!