I need to convert the decimal hours minutes value(ex: 2.36 - hours.minutes) to the nearest quarter hours (2.25). Is there any way to do it in Angular using typescript. the input will be 2.36 and I need to convert it into 2.25(where .25 is quarter-hour for 36 mins). I did it in C# using Timespan like below-
var time = TimeSpan.FromHours(2.36) // time: {02:21:36}
decimal round = (decimal)time.Minutes / 15; // round : 1.4M
round = Decimal.Round(round, MidpointRounding.AwayFromZero)*15;//round :15
var roundedTime = (float)(new TimeSpan(time.Hours, (int)round, 0).TotalHours); // o/p roundedTime: 2.25
Is there any TimeSpan equivalent in typescript or conversion for above c# to typescript? Thanks in advance!