且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jQuery在ASP Net Core 2剃须刀中设置日期值

更新时间:2023-02-14 20:11:42

[Display(Name = "Monday")]
[DataType(DataType.Date)]
public DateTime? MondayOfCurrentWeek
    {
        get
        {
            DateTime today = DateTime.Today;
            int currentDayOfWeek = (int)today.DayOfWeek;
            DateTime sunday = today.AddDays(-currentDayOfWeek);
            DateTime monday = sunday.AddDays(1);
            return monday;
        };
        set;
    }

这可能是后端的一些解决方法.在名为"today"的变量中,您可以输入每一天,例如"OpeningDate",它应返回所需的实际星期的星期一,当您获得x.Project.MondayOfCurrentWeek时,您将收到星期一的日期.如果有用,请发送一些反馈.

This is maybe a little workaround in the back-end. In variable named "today" you can put every day for example "OpeningDate" and it should return the date of Monday of the actual week you want and when you get x.Project.MondayOfCurrentWeek you will receive the date for Monday. Send some feedback if it is useful.