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

Create Dates with Current Time #671

Merged
merged 5 commits into from
Nov 19, 2023
Merged

Create Dates with Current Time #671

merged 5 commits into from
Nov 19, 2023

Conversation

sinclairzx81
Copy link
Owner

@sinclairzx81 sinclairzx81 commented Nov 19, 2023

This PR updates the handling of Type.Date when initializing via Value.Create or Value.Cast. Previous to this PR, Dates would initialize to unix epoch (timestamp 0). This PR ensures dates are initialized to the current time.

This behavior is inline with the following.

const date = Value.Create(Type.Date()) // current time

const date = new Date()                // current time

This behavior can be overridden by specifying a default value.

const date = Value.Create(Type.Date({ default: new Date(1000) )) // 1 second past epoch

Additional updates include fixes to the type compositor clone, ensuring types with default value of instance Date or Uint8Array are appropriately cloned as their instance types.

Related Issue: #670

@sinclairzx81 sinclairzx81 changed the title Use Current Date when Creating Date Types Create Dates with Current Time Nov 19, 2023
@sinclairzx81 sinclairzx81 merged commit ea217cc into master Nov 19, 2023
18 checks passed
@sinclairzx81 sinclairzx81 deleted the date branch November 19, 2023 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant