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

Patch for partial records #94

Merged
merged 3 commits into from
Aug 19, 2024
Merged

Patch for partial records #94

merged 3 commits into from
Aug 19, 2024

Conversation

nekevss
Copy link
Member

@nekevss nekevss commented Aug 16, 2024

This PR is a patch for some things I found while doing some implementation of temporal_rs in Boa.

The things the PR addresses / patches

  • Adds a DateTime::from_date_and_time
  • I noticed that the with methods weren't checking whether the partials were empty, which would not be valid. This update throws an early error if the partial provided is empty.
  • Changed the internal way for constructing a TemporalFields from a PartialDate. Primarily, after doing the implementation, I don't think having a From<PartialDate> for TemporalFields is a good idea. We will still need it internally, but I'm now leaning more towards using the calendar to generate the fields from a partial. Something akin to calendar::create_fields_from_partial_date(partial_date).

@nekevss nekevss added the C-internal Internal library improvements label Aug 16, 2024
Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Only found a typo which doesn't block merging this.

src/fields.rs Outdated
@@ -471,6 +471,40 @@ impl TemporalFields {

Ok(result)
}

/// Creates a `TemporalFeild` from a `PartialDate`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Creates a `TemporalFeild` from a `PartialDate`.
/// Creates a `TemporalField` from a `PartialDate`.

@nekevss nekevss merged commit 1e7901d into main Aug 19, 2024
5 checks passed
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-internal Internal library improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants