Handle date when creating user delegations #19434

Back

Description

Resolves #19433

Checklist

  • I fully tested it as developer / designer and created unit / integration tests
  • I documented it (or no need to document or I will create a separate documentation issue)
  • I worked with the design team to get their idea for UI/UX design (or no need to design for this PR)
  • I've assigned reviewer, related labels and set a milestone for this PR

How to test it?

Since we have to release a new patch version: https://github.com/abpframework/abp/pull/22226

So copy flowing code to DelegateNewUserModal.js for testing.

  abp.clock.normalizeToString = function (date) {
      if (!date) {
          return date;
      }

      var dateObj = date instanceof Date ? date : new Date(date);
      if (isNaN(dateObj)) {
          return date;
      }

      if (abp.clock.kind === 'Utc') {
          return dateObj.toISOString();
      }

      function padZero(num) {
          return num < 10 ? '0' + num : num;
      }

      function padMilliseconds(num) {
          if (num < 10) return '00' + num;
          if (num < 100) return '0' + num;
          return num;
      }
      
      // yyyy-MM-ddTHH:mm:ss.SSS
      return dateObj.getFullYear() + '-' +
              padZero(dateObj.getMonth() + 1) + '-' +
              padZero(dateObj.getDate()) + 'T' +
              padZero(dateObj.getHours()) + ':' +
              padZero(dateObj.getMinutes()) + ':' +
              padZero(dateObj.getSeconds()) + '.' +
              padMilliseconds(dateObj.getMilliseconds());
  };
Version
9.0.6
Release Date
03 March, 2025
Labels
No labels