Skip to content

Add TimeZone::utc() to FFI#358

Merged
Manishearth merged 2 commits into
boa-dev:mainfrom
Manishearth:tz-utc-ffi
Jul 17, 2025
Merged

Add TimeZone::utc() to FFI#358
Manishearth merged 2 commits into
boa-dev:mainfrom
Manishearth:tz-utc-ffi

Conversation

@Manishearth

Copy link
Copy Markdown
Contributor

Cloning is generally useful, and utc() allows for infallible construction (currently there is no way to infallibly construct a timezone)

@Manishearth

Manishearth commented Jun 20, 2025

Copy link
Copy Markdown
Contributor Author

Also open to adding a generic infallible construction API for the IanaIdentifier variant.

@Manishearth Manishearth changed the title Add TimeZone::utc() to FFI, add cloningx Add TimeZone::utc() to FFI, add cloning Jun 20, 2025
Box::new(Self(self.0.clone()))
}
pub fn utc() -> Box<Self> {
Box::new(Self(temporal_rs::TimeZone::IanaIdentifier("UTC".into())))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

question: any general thoughts on how this may update with any future changes around #330.

I'm mostly concerned about how changes to TimeZone may affect this in the future.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It seems like we're not sure about Copy TimeZones being a thing, in that case I think we should land this

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I still think making this copy is the best general approach, but in the meantime agreed on moving forward as is.

@Manishearth Manishearth force-pushed the tz-utc-ffi branch 2 times, most recently from e10ccb5 to 4b504e5 Compare June 21, 2025 00:24
@Manishearth Manishearth changed the title Add TimeZone::utc() to FFI, add cloning Add TimeZone::utc() to FFI Jun 21, 2025
@Manishearth Manishearth merged commit 17e60fb into boa-dev:main Jul 17, 2025
8 checks passed
@Manishearth Manishearth deleted the tz-utc-ffi branch July 17, 2025 18:56
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.

2 participants