From a2a52ef14666e331fafd132eca11d424ddd6b116 Mon Sep 17 00:00:00 2001 From: Mr-Rm Date: Tue, 2 Jun 2026 17:11:32 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B5=D0=B4=D0=BE=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D1=8E=D1=89=D0=B8=D0=B5=20=D0=B2=D1=81=D1=82=D1=80=D0=BE=D0=B5?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=D0=B5=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/OneScript.Native/Runtime/BuiltInFunctions.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/OneScript.Native/Runtime/BuiltInFunctions.cs b/src/OneScript.Native/Runtime/BuiltInFunctions.cs index 1bb5c2e3f..861209f24 100644 --- a/src/OneScript.Native/Runtime/BuiltInFunctions.cs +++ b/src/OneScript.Native/Runtime/BuiltInFunctions.cs @@ -265,6 +265,12 @@ public static int StrEntryCount(string where, string what) [ContextMethod("НачалоМесяца", "BegOfMonth")] public static DateTime BegOfMonth(DateTime date) => new DateTime(date.Year, date.Month, 1); + [MethodImpl(MethodImplOptions.AggressiveInlining)] + [ContextMethod("НачалоНедели", "BegOfWeek")] + public static DateTime BegOfWeek(DateTime date) + => new DateTime(date.Year, date.Month, date.Day) + .AddDays(-((int)date.DayOfWeek+6)%7); + [MethodImpl(MethodImplOptions.AggressiveInlining)] [ContextMethod("НачалоДня", "BegOfDay")] public static DateTime BegOfDay(DateTime date) => new DateTime(date.Year, date.Month, date.Day); @@ -321,6 +327,12 @@ public static DateTime EndOfMonth(DateTime date) return new DateTime(year, month, DateTime.DaysInMonth(year, month), 23, 59, 59); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + [ContextMethod("КонецНедели", "EndOfWeek")] + public static DateTime EndOfWeek(DateTime date) + => new DateTime(date.Year, date.Month, date.Day, 23, 59, 59) + .AddDays((7-(int)date.DayOfWeek) % 7); + [MethodImpl(MethodImplOptions.AggressiveInlining)] [ContextMethod("КонецДня", "EndOfDay")] public static DateTime EndOfDay(DateTime date) => new DateTime(date.Year, date.Month, date.Day, 23, 59, 59);