๐Ÿน @date Operator in TuskLang - Go Guide

Go Documentation

@date Operator in TuskLang - Go Guide

โฐ Time is Power: @date Operator Mastery

TuskLang's @date operator is your temporal superpower. We don't bow to any kingโ€”not even time itself. Here's how to wield @date in Go projects for dynamic, time-aware configuration.

๐Ÿ“‹ Table of Contents

- What is @date? - Basic Usage - Date Formatting - Date Calculations - Go Integration - Best Practices

๐Ÿ• What is @date?

The @date operator provides dynamic date and time operations directly in your config. From timestamps to relative dates, @date makes your config time-aware.

๐Ÿ› ๏ธ Basic Usage

[build]
build_time: @date.now()
build_date: @date("Y-m-d")

๐Ÿ“… Date Formatting

[timestamps]
iso_time: @date("2006-01-02T15:04:05Z07:00")
short_date: @date("2006-01-02")
long_date: @date("Monday, January 2, 2006")

๐Ÿงฎ Date Calculations

[expiry]
tomorrow: @date("+1d")
next_week: @date("+7d")
next_month: @date("+1M")

๐Ÿ”— Go Integration

buildTime := config.GetString("build_time")
buildDate := config.GetString("build_date")

Manual Date Operations

now := time.Now()
formatted := now.Format("2006-01-02")
tomorrow := now.AddDate(0, 0, 1)

๐Ÿฅ‡ Best Practices

- Use ISO 8601 format for timestamps - Cache expensive date calculations - Validate date ranges in your Go code

---

TuskLang: Time is on your side with @date.