Skip to content

Conversation

@lsndr
Copy link
Owner

@lsndr lsndr commented Dec 6, 2025

No description provided.

@lsndr lsndr self-assigned this Dec 6, 2025
@lsndr lsndr added the enhancement New feature or request label Dec 6, 2025
@lsndr lsndr requested a review from Copilot December 6, 2025 11:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds two new factory methods to the DateTime class for creating instances from JavaScript's native Date objects and Unix timestamps. The methods (fromDate and fromTimestamp) complement the existing factory methods (fromPlain, fromString, etc.) and provide convenient interoperability with standard JavaScript date handling.

Key changes:

  • Added DateTime.fromDate() static method to create UTC DateTime from JavaScript Date objects
  • Added DateTime.fromTimestamp() static method to create UTC DateTime from Unix timestamps in milliseconds
  • Added comprehensive test suites for both new factory methods including round-trip conversion tests

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/datetime.ts Implements fromDate and fromTimestamp factory methods with proper JSDoc documentation; fromTimestamp delegates to fromDate for implementation
tests/unit/datetime.spec.ts Adds test suites for both factory methods with parameterized tests and round-trip conversion validation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lsndr lsndr merged commit f0f5fd2 into next Dec 6, 2025
44 checks passed
@lsndr lsndr deleted the feat/add-factory-methods-to-datetime-object branch December 6, 2025 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants