Browse Source

* Add IsDate

michael 5 years ago
parent
commit
cc0cee2387
1 changed files with 6 additions and 0 deletions
  1. 6 0
      packages/rtl/js.pas

+ 6 - 0
packages/rtl/js.pas

@@ -856,6 +856,7 @@ function hasString(const v: JSValue): boolean; external name 'rtl.hasString';//
 function hasValue(const v: JSValue): boolean; assembler; // returns the JS definition of if(v): v is not false, undefined, null, 0, NaN, or the empty string. Note: JS if(new Boolean(false)) returns true.
 function isArray(const v: JSValue): boolean; external name 'rtl.isArray';
 function isBoolean(const v: JSValue): boolean; assembler;
+function isDate(const v: JSValue): boolean; assembler;
 function isCallback(const v: JSValue): boolean; assembler;
 function isChar(const v: JSValue): boolean; assembler;
 function isClass(const v: JSValue): boolean; assembler; // is a Pascal class, e.g. a TClass
@@ -941,6 +942,11 @@ asm
   return typeof(v) == 'boolean';
 end;
 
+function isDate(const v: JSValue): boolean; assembler;
+asm
+  return (v instanceof Date);
+end;
+
 function isCallback(const v: JSValue): boolean; assembler;
 asm
   return rtl.isObject(v) && rtl.isObject(v.scope) && (rtl.isString(v.fn) || rtl.isFunction(v.fn));