date-vir - v8.5.0
    Preparing search index...

    Function overrideDateParts

    • Override the initial provided FullDate with all subsequent FullDate parts.

      Type Parameters

      • const SpecificTimezone extends string

      Parameters

      • date: {
            day: DayOfMonth;
            hour: Hour;
            millisecond: number;
            minute: Minute;
            month: MonthNumber;
            second: Minute;
            timezone: SpecificTimezone;
            year: number;
        }
        • day: DayOfMonth

          A day of the month: 1-31 depending on the month

        • hour: Hour

          Hour of the day in 24 time: 0-23

        • millisecond: number

          Millisecond of the second: 0-999

        • minute: Minute

          Minute of the hour: 0-59

        • month: MonthNumber

          A month of the year: 1-12

        • second: Minute
        • timezone: SpecificTimezone
        • year: number

          The full, four digit year.

          2023;
          
      • ...overrides: Partial<
            {
                day: DayOfMonth;
                hour: Hour;
                millisecond: number;
                minute: Minute;
                month: MonthNumber;
                second: Minute;
                timezone: SpecificTimezone;
                year: number;
            },
        >[]

      Returns {
          day: DayOfMonth;
          hour: Hour;
          millisecond: number;
          minute: Minute;
          month: MonthNumber;
          second: Minute;
          timezone: SpecificTimezone;
          year: number;
      }

      • day: DayOfMonth

        A day of the month: 1-31 depending on the month

      • hour: Hour

        Hour of the day in 24 time: 0-23

      • millisecond: number

        Millisecond of the second: 0-999

      • minute: Minute

        Minute of the hour: 0-59

      • month: MonthNumber

        A month of the year: 1-12

      • second: Minute
      • timezone: SpecificTimezone
      • year: number

        The full, four digit year.

        2023;
        
      import {overrideDateParts, type FullDate} from 'date-vir';

      const exampleDate: Readonly<FullDate> = {
      year: 2024,
      month: 1,
      day: 5,
      hour: 1,
      minute: 1,
      second: 1,
      millisecond: 1,
      timezone: 'UTC',
      };

      overrideDateParts(exampleDate, {day: 20}, {second: 10});
      // `{year: 2024, month: 1, day: 20, hour: 1, minute: 1, second: 10, millisecond: 1, timezone: 'UTC'}`