Files
hakorune/local_tests/test_datetime_box.hako

43 lines
1.1 KiB
Plaintext
Raw Normal View History

// test_datetime_box.hako - DateTimeBox functionality test
// Phase 3: DateTimeBox implementation validation
print("📅 Testing DateTimeBox implementation...")
// Basic DateTimeBox creation
local now, timestamp_dt, parsed_dt, result
// Test 1: Current time creation
now = new DateTimeBox()
print("Current time: " + now.toString())
// Test 2: Timestamp creation
timestamp_dt = new DateTimeBox(1640995200) // 2022-01-01 00:00:00 UTC
print("From timestamp: " + timestamp_dt.toString())
// Test 3: Date component extraction
result = now.year()
print("Current year: " + result.toString())
result = now.month()
print("Current month: " + result.toString())
result = now.day()
print("Current day: " + result.toString())
result = now.hour()
print("Current hour: " + result.toString())
result = now.minute()
print("Current minute: " + result.toString())
result = now.second()
print("Current second: " + result.toString())
// Test 4: Date arithmetic
result = now.addDays(7)
print("7 days from now: " + result.toString())
result = now.addHours(24)
print("24 hours from now: " + result.toString())
print("✅ DateTimeBox Phase 3 tests completed!")