90 lines
2.2 KiB
Markdown
90 lines
2.2 KiB
Markdown
# Temporalz
|
|
|
|
[](https://github.com/nurulhudaapon/temporalz/actions/workflows/ci.yml)
|
|
|
|
A Zig library for working with temporal types based on the [Temporal Standard](https://tc39.es/proposal-temporal/).
|
|
|
|
Temporalz provides Zig bindings to the Rust-based [temporal_rs](https://github.com/boa-dev/temporal) library for handling dates, times, and durations with proper timezone support.
|
|
|
|
## Installation
|
|
|
|
#### Prerequisites
|
|
|
|
- Zig 0.17.0-dev.1398+cb5635714
|
|
- Rust toolchain (only required if [prebuilt staticlibs](#prebuilt) are not available for your platform)
|
|
|
|
#### Add as a Dependency
|
|
|
|
```bash
|
|
zig fetch --save git+https://github.com/nurulhudaapon/temporalz.git
|
|
```
|
|
|
|
#### Use in build.zig
|
|
|
|
Add temporalz to your executable in `build.zig`:
|
|
|
|
```zig
|
|
const temporalz = b.dependency("temporalz", .{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
|
|
const exe = b.addExecutable(.{...});
|
|
|
|
exe.root_module.addImport("temporalz", temporalz.module("temporalz"));
|
|
```
|
|
|
|
## Checklist
|
|
|
|
| Namespace | Status |
|
|
| -------------- | ------ |
|
|
| Instant | ✅ |
|
|
| Duration | ✅ |
|
|
| PlainDate | ✅ |
|
|
| PlainTime | ✅ |
|
|
| PlainDateTime | ✅ |
|
|
| PlainYearMonth | ✅ |
|
|
| PlainMonthDay | ✅ |
|
|
| ZonedDateTime | ✅ |
|
|
|
|
## Prebuilt
|
|
|
|
Prebuilt libraries are included for the following platforms:
|
|
|
|
- `x86_64-macos`, `aarch64-macos`
|
|
- `x86_64-linux-gnu`, `aarch64-linux-gnu`, `x86-linux-gnu`, `arm-linux-gnueabihf`
|
|
- `loongarch64-linux-gnu`, `powerpc64le-linux-gnu`, `riscv64-linux-gnu`, `s390x-linux-gnu`
|
|
- `x86_64-windows-gnu`, `aarch64-windows-gnu`, `x86-windows-gnu`
|
|
- `x86_64-freebsd`, `x86_64-netbsd`
|
|
- `wasm32-freestanding`, `wasm32-wasi`
|
|
- `x86_64-linux-musl`, `aarch64-linux-musl`
|
|
- `aarch64-linux-android`, `aarch64-ios`
|
|
|
|
For other platforms, the library will build from source; you need the Rust toolchain installed.
|
|
|
|
## Development
|
|
|
|
#### Clone the Repository
|
|
|
|
```bash
|
|
git clone https://github.com/nurulhudaapon/temporalz.git
|
|
cd temporalz
|
|
```
|
|
|
|
#### Build and Run
|
|
|
|
```bash
|
|
zig build run
|
|
|
|
# Node.js
|
|
zig build run -Dtarget=wasm32-freestanding
|
|
|
|
# wasmtime
|
|
zig build run -Dtarget=wasm32-wasi
|
|
```
|
|
|
|
#### Run Tests
|
|
|
|
```bash
|
|
zig build test
|
|
```
|