temporalz/README.md
2026-01-26 21:50:48 +06:00

82 lines
1.5 KiB
Markdown

# Temporalz
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.15.2
- Rust toolchain (only required if [prebuilt binaries](#prebuilt) are not available for your platform)
#### Add as a Dependency
```bash
zig fetch --save https://github.com/nurulhudaapon/temporalz/archive/refs/tags/v0.1.2.tar.gz
```
#### Use in build.zig
Add temporalz to your executable in `build.zig`:
```zig
const temporalz_dep = b.dependency("temporalz", .{ .target = target, .optimize = optimize });
const exe = b.addExecutable(.{...});
exe.root_module.addImport("temporalz", temporalz_dep.module("temporalz"));
```
## Checklist
- [x] Instant
- [x] Duration
- [ ] PlainDate
- [ ] PlainTime
- [ ] PlainDateTime
- [ ] PlainYearMonth
- [ ] PlainMonthDay
- [ ] ZonedDateTime
## Prebuilt
Prebuilt libraries are included for the following platforms:
- `aarch64-macos`
- `x86_64-macos`
- `aarch64-linux-gnu`
- `x86_64-linux-gnu`
- `x86_64-windows-gnu`
- `aarch64-windows-gnu`
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
```
#### Run Tests
```bash
zig build test
```
## License
MIT