Skip to content

Глобальная функция ЗаписатьДатуJSON / WriteJSONDate#1711

Open
Stivo182 wants to merge 1 commit into
EvilBeaver:developfrom
Stivo182:feature/write-json-date
Open

Глобальная функция ЗаписатьДатуJSON / WriteJSONDate#1711
Stivo182 wants to merge 1 commit into
EvilBeaver:developfrom
Stivo182:feature/write-json-date

Conversation

@Stivo182

@Stivo182 Stivo182 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor
  • Добавлена глобальная функция ЗаписатьДатуJSON / WriteJSONDate для преобразования даты в строковое представление JSON с поведением, соответствующим 1С.
  • Добавлено перечисление ВариантЗаписиДатыJSON / JSONDateWritingVariant.

Summary by CodeRabbit

  • New Features
    • Added JSON date serialization through ЗаписатьДатуJSON / WriteJSONDate.
    • Supports ISO, JavaScript, and Microsoft date formats.
    • Added local, local-with-offset, and universal date variants.
    • JavaScript and Microsoft formats now produce compatible universal-date representations.
    • Date precision, timezone offsets, supported ranges, and invalid input combinations are handled with clear errors.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e3c3e798-99b1-43a6-a938-77b0ffad172a

📥 Commits

Reviewing files that changed from the base of the PR and between 1c19450 and 5236e94.

📒 Files selected for processing (4)
  • src/OneScript.StandardLibrary/Json/GlobalJsonFunctions.cs
  • src/OneScript.StandardLibrary/Json/JSONDateWriter.cs
  • src/OneScript.StandardLibrary/Json/JSONDateWritingVariantEnum.cs
  • tests/json/test-json_date.os

📝 Walkthrough

Walkthrough

Adds ЗаписатьДатуJSON/WriteJSONDate, a date-writing variant enumeration, serialization for ISO, JavaScript, and Microsoft formats, timezone and boundary handling, validation errors, and comprehensive tests.

Changes

JSON date serialization

Layer / File(s) Summary
Date variants and serialization
src/OneScript.StandardLibrary/Json/JSONDateWritingVariantEnum.cs, src/OneScript.StandardLibrary/Json/JSONDateWriter.cs
Defines local, offset, and universal date variants and formats validated dates as ISO, JavaScript, or Microsoft JSON strings.
Public JSON date entrypoint
src/OneScript.StandardLibrary/Json/GlobalJsonFunctions.cs
Adds WriteJSONDate with an optional local-date variant and delegates serialization to JSONDateWriter.
Serialization behavior tests
tests/json/test-json_date.os
Tests output formats, timezone variants, epoch and date boundaries, invalid arguments, and unsupported JavaScript/Microsoft variants.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant GlobalJsonFunctions
  participant JSONDateWriter
  participant TimeZoneInfo
  Caller->>GlobalJsonFunctions: WriteJSONDate(date, format, variant)
  GlobalJsonFunctions->>JSONDateWriter: Write(date, format, variant)
  JSONDateWriter->>TimeZoneInfo: Convert local time or calculate offset
  TimeZoneInfo-->>JSONDateWriter: UTC time or local offset
  JSONDateWriter-->>GlobalJsonFunctions: JSON date string
  GlobalJsonFunctions-->>Caller: Return serialized date
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely names the main change: adding the global JSON date-writing function.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant