// Changes to this file must follow the http://aka.ms/api-review process.
// ------------------------------------------------------------------------------
+using System;
+
namespace Microsoft.VisualBasic
{
public enum CallType
public const char VerticalTab = '\v';
public ControlChars() { }
}
+ [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute]
+ public sealed partial class DateAndTime
+ {
+ internal DateAndTime() { }
+ public static DateTime Now { get; }
+ public static DateTime Today { get; }
+ }
[System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=false)]
[System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))]
public sealed partial class HideModuleNameAttribute : System.Attribute
<Compile Include="Microsoft\VisualBasic\Constants.vb" />
<Compile Include="Microsoft\VisualBasic\ControlChars.vb" />
<Compile Include="Microsoft\VisualBasic\CompilerServices\DoubleType.vb" />
+ <Compile Include="Microsoft\VisualBasic\DateAndTime.vb" />
<Compile Include="Microsoft\VisualBasic\HideModuleNameAttribute.vb" />
<Compile Include="Microsoft\VisualBasic\Information.vb" />
<Compile Include="Microsoft\VisualBasic\Interaction.vb" />
--- /dev/null
+' Licensed to the .NET Foundation under one or more agreements.
+' The .NET Foundation licenses this file to you under the MIT license.
+' See the LICENSE file in the project root for more information.
+
+Imports System
+
+Namespace Microsoft.VisualBasic
+ Public Module DateAndTime
+ Public ReadOnly Property Now As DateTime
+ Get
+ Return DateTime.Now
+ End Get
+ End Property
+
+ Public ReadOnly Property Today As DateTime
+ Get
+ Return DateTime.Today
+ End Get
+ End Property
+ End Module
+End Namespace
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using Xunit;
+
+namespace Microsoft.VisualBasic.Tests
+{
+ public class DateAndTimeTests
+ {
+ [Fact]
+ public void Now_ReturnsDateTimeNow()
+ {
+ var dateTimeNowBefore = DateTime.Now;
+ var now = DateAndTime.Now;
+ var dateTimeNowAfter = DateTime.Now;
+
+ Assert.InRange(now, dateTimeNowBefore, dateTimeNowAfter);
+ }
+
+ [Fact]
+ public void Today_ReturnsDateTimeToday()
+ {
+ var dateTimeTodayBefore = DateTime.Today;
+ var today = DateAndTime.Today;
+ var dateTimeTodayAfter = DateTime.Today;
+
+ Assert.InRange(today, dateTimeTodayBefore, dateTimeTodayAfter);
+ Assert.Equal(TimeSpan.Zero, today.TimeOfDay);
+ }
+ }
+}
<Compile Include="Microsoft/VisualBasic/Devices/NetworkAvailableEventArgsTests.cs" />
<Compile Include="ConversionsTests.cs" />
<Compile Include="OperatorsTests.cs" />
+ <Compile Include="DateAndTimeTests.cs" />
<Compile Include="InformationTests.cs" />
<Compile Include="UtilsTests.cs" />
<Compile Include="StringsTests.cs" />