Class sap.suite.ui.commons.util.DateUtilsModule: sap/suite/ui/commons/util/DateUtils


DateUtils is a static class for Date utility functions.

Constructor Summary
new sap.suite.ui.commons.util.DateUtils()Constructor for DateUtils - must not be used.
Method Summary
sap.suite.ui.commons.util.DateUtils.dateDaysEqual(dDate1, dDate2)Tests to see if two dates have the same year, month, and day.
sap.suite.ui.commons.util.DateUtils.dateMonthsEqual(dDate1, dDate2)Tests to see if two dates have the same year and month.
sap.suite.ui.commons.util.DateUtils.incrementDateByIndex(dStartDate, iIndex)Returns the date that is iIndex days from the dStartDate
sap.suite.ui.commons.util.DateUtils.incrementMonthByIndex(dStartDate, iIndex)Returns the date that is iIndex months from the dStartDate
sap.suite.ui.commons.util.DateUtils.isValidDate(The)Test if the given date is a valid date object.
sap.suite.ui.commons.util.DateUtils.numberOfDaysApart(dStartDate, dEndDate)Returns the number of days two dates are apart
sap.suite.ui.commons.util.DateUtils.numberOfMonthsApart(dStartDate, dEndDate)Returns the number of months two dates are apart
sap.suite.ui.commons.util.DateUtils.resetDateToEndOfDay(The)Adjust the given date to the end of the day, with time set to 23 hours, 59 minutes, and 59 seconds.
sap.suite.ui.commons.util.DateUtils.resetDateToEndOfMonth(The)Adjust the given date to the last day of the month, end of day.
sap.suite.ui.commons.util.DateUtils.resetDateToEndOfWeek(oSettings)Adjust the given date to oSettings.iDuration days after the day specified by oSettings.iFirstDayOfWeek.
sap.suite.ui.commons.util.DateUtils.resetDateToEndOfYear(The)Adjust the given date to the last day of the year, end of day.
sap.suite.ui.commons.util.DateUtils.resetDateToStartOfDay(The)Adjust the given date to the start of the day, with time set to 0 hours, 0 minutes, and 0 seconds.
sap.suite.ui.commons.util.DateUtils.resetDateToStartOfMonth(The)Adjust the given date to the first day of the month, start of day.
sap.suite.ui.commons.util.DateUtils.resetDateToStartOfWeek(The, iFirstDayOfWeek?)Adjust the given date to the day specified by iFirstDayOfWeek.
sap.suite.ui.commons.util.DateUtils.resetDateToStartOfYear(The)Adjust the given date to the first day of the year, start of day.
Constructor Detail
new sap.suite.ui.commons.util.DateUtils()
Constructor for DateUtils - must not be used. All functions are static, so it is illegal to call this constructor.
Method Detail
sap.suite.ui.commons.util.DateUtils.dateDaysEqual(dDate1, dDate2): boolean
Tests to see if two dates have the same year, month, and day. Time is not included in the equality. Invalid dates, such as null or undefined, are never equal.
Parameters:
{Date}dDate1 First date to compare.
{Date}dDate2 Second date to compare.
Returns:
{boolean} true if two dates have same year, month, and day, otherwise false
sap.suite.ui.commons.util.DateUtils.dateMonthsEqual(dDate1, dDate2): boolean
Tests to see if two dates have the same year and month. Time is not included in the equality. Invalid dates, such as null or undefined, are never equal.
Parameters:
{Date}dDate1 First date to compare.
{Date}dDate2 Second date to compare.
Returns:
{boolean} true if two dates have same year and month, otherwise false
sap.suite.ui.commons.util.DateUtils.incrementDateByIndex(dStartDate, iIndex): Date
Returns the date that is iIndex days from the dStartDate
Parameters:
{Date}dStartDate Start date.
{int}iIndex how many days to move forward or backward from dStartDate.
Returns:
{Date} date that is iIndex days from the dStartDate if dStartDate and iIndex are valid, otherwise null.
sap.suite.ui.commons.util.DateUtils.incrementMonthByIndex(dStartDate, iIndex): Date
Returns the date that is iIndex months from the dStartDate
Parameters:
{Date}dStartDate Start date.
{int}iIndex how many months to move forward or backward from dStartDate.
Returns:
{Date} date that is iIndex months from the dStartDate if dStartDate and iIndex are valid, otherwise null.
sap.suite.ui.commons.util.DateUtils.isValidDate(The)
Test if the given date is a valid date object. If the date is invalid an error message is logged.
Parameters:
{Date}The date to be validated.
sap.suite.ui.commons.util.DateUtils.numberOfDaysApart(dStartDate, dEndDate): Number
Returns the number of days two dates are apart
Parameters:
{Date}dStartDate Start date.
{Date}dEndDate End date.
Returns:
{Number} number of days two dates are apart
sap.suite.ui.commons.util.DateUtils.numberOfMonthsApart(dStartDate, dEndDate): Number
Returns the number of months two dates are apart
Parameters:
{Date}dStartDate Start date.
{Date}dEndDate End date.
Returns:
{Number} number of months two dates are apart
sap.suite.ui.commons.util.DateUtils.resetDateToEndOfDay(The)
Adjust the given date to the end of the day, with time set to 23 hours, 59 minutes, and 59 seconds.
Parameters:
{Date}The date to be adjusted.
sap.suite.ui.commons.util.DateUtils.resetDateToEndOfMonth(The)
Adjust the given date to the last day of the month, end of day.
Parameters:
{Date}The date to be adjusted.
sap.suite.ui.commons.util.DateUtils.resetDateToEndOfWeek(oSettings)
Adjust the given date to oSettings.iDuration days after the day specified by oSettings.iFirstDayOfWeek. See resetDateToStartOfWeek() for a description of how the date is adjusted to the first day of week.
Parameters:
{Object}oSettings
oSettings.iDuration?, Default: 7 The number of days in the week with a minimum of 1 and maximum of 7.
oSettings.iFirstDayOfWeek?, Default: 1 The day considered to be the first day of the week. Valid values are 0-6, with 0=Sunday and 6=Saturday.
sap.suite.ui.commons.util.DateUtils.resetDateToEndOfYear(The)
Adjust the given date to the last day of the year, end of day.
Parameters:
{Date}The date to be adjusted.
sap.suite.ui.commons.util.DateUtils.resetDateToStartOfDay(The)
Adjust the given date to the start of the day, with time set to 0 hours, 0 minutes, and 0 seconds.
Parameters:
{Date}The date to be adjusted.
sap.suite.ui.commons.util.DateUtils.resetDateToStartOfMonth(The)
Adjust the given date to the first day of the month, start of day.
Parameters:
{Date}The date to be adjusted.
sap.suite.ui.commons.util.DateUtils.resetDateToStartOfWeek(The, iFirstDayOfWeek?)
Adjust the given date to the day specified by iFirstDayOfWeek. The date will be set to the previous first day of the week. For example, if the date is Tuesday, February 19 and the value of iFirstDayOfWeek is 4 (Thursday), then the date will be adjusted to the previous Thursday, which is February 14.
Parameters:
{Date}The date to be adjusted.
iFirstDayOfWeek?, Default: 1 The day considered to be the first day of the week. Valid values are 0-6, with 0=Sunday and 6=Saturday.
sap.suite.ui.commons.util.DateUtils.resetDateToStartOfYear(The)
Adjust the given date to the first day of the year, start of day.
Parameters:
{Date}The date to be adjusted.