• Converts a timestamp (in seconds) into a DateData objet from the specified calendar

    Returns

    A date object with information about the date the timestamp represents or null if the specified calendar can not be found

    Example

    // Assuming Gregorian Calendar with the current date of June 1, 2021
    let scDate = SimpleCalendar.api.timestampToDate(1622505600);
    console.log(scDate);
    // This is what the returned object will look like
    // {
    // "currentSeason": { "showAdvanced": false, "id": "75a4ba97", "name": "Spring", "numericRepresentation": null, "description": "", "abbreviation": "", "color": "#46b946", "startingMonth": 2, "startingDay": 19, "sunriseTime": 21600, "sunsetTime": 64800, "icon": "spring"},
    // day: 0,
    // dayOfTheWeek: 2,
    // dayOffset: 0,
    // display: {
    // date: "June 01, 2021",
    // day: "1",
    // daySuffix: "st",
    // month: "6",
    // monthName: "June",
    // time: "00:00:00",
    // weekday: "Tuesday",
    // year: "2021",
    // yearName: "",
    // yearPostfix: "",
    // yearPrefix: "",
    // },
    // hour: 0,
    // isLeapYear: false,
    // midday: 1622548800,
    // minute: 0,
    // month: 5,
    // second: 0,
    // showWeekdayHeadings: true,
    // sunrise: 1622527200,
    // sunset: 1622570400,
    // weekdays: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
    // year: 2021,
    // yearZero: 1970
    // }

    Parameters

    • seconds: number

      The timestamp (in seconds) to convert into a date object.

    • calendarId: string = 'active'

      Optional parameter to specify the ID of the calendar to use to calculate the DateData objet. If not provided the current active calendar will be used.

    Returns DateData | null