Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include luxon date time options to date #177

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

odparraj
Copy link

Proposed changes

Including the luxon date time options increases the developer's possibilities in other scenarios, here are some of them:

  • It is required to receive a date in ISO format and the validation result must return the time zone specified by the developer (ex: UTC):
    { published_at: schema.date({ format: 'iso', opts: { zone: 'UTC' } }) }
    input: 2023-09-28T17:05:05.903-04:00
    output: 2023-09-28T21:05:05.903Z

  • It is required to receive a date in ISO format and the validation result to return a DateTime object with the same input time zone, not necessarily the default time zone as it currently works, (assume default time zone in UTC):

{ published_at: schema.date({ format: 'iso', opts: { setZone: true } }) }
input: 2023-09-28T17:05:05.903-04:00
expected output equals to input: 2023-09-28T17:05:05.903-04:00
current output: 2023-09-28T21:05:05.903Z

  • Reuse a schema in different parts ensuring the same output format, consider a data enrichment scenario where you have a validation scheme that includes a date with ISO format, in step 1 a DateTime object is created with a different time zone to the default, it is validated and everything is ok, the user serializes the response and saves it in some storage as json, then in step 2 he recovers the serialized result, makes some changes and wants to use the same schema to validate, like now the field validated as date is a string, the validator internally creates a new DateTime that will remain with the default time zone, when serializing again to continue the sequence of steps, the stored data will be in a different format than the one initially set

Types of changes

What types of changes does your code introduce?

Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

Copy link

stale bot commented Dec 15, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Abandoned Dropped and not into consideration label Dec 15, 2023
@odparraj
Copy link
Author

@RomainLanz Is it possible to review this, I would like to stop using the fork

@stale stale bot removed the Status: Abandoned Dropped and not into consideration label Jan 15, 2024
Copy link

stale bot commented Mar 17, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Abandoned Dropped and not into consideration label Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Abandoned Dropped and not into consideration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant