loopbackio / loopback-connector-mssql

LoopBack connector for Microsoft SQL Server
http://loopback.io/doc/en/lb3/SQL-Server-connector.html
Other
52 stars 84 forks source link

Loopback 4 can not parsing javascript Date Object to native SQL statement which require Date parameter #234

Closed wdrdres3qew5ts21 closed 3 years ago

wdrdres3qew5ts21 commented 3 years ago

Steps to reproduce

  1. Using Loopback 4 with MS-SQL 2008 Database
  2. Execute Store Procedure which require Datetime parameter
  3. Error with using params for passing parameter (@param1, @param2, @param3...) to call Store Procedure
  4. Error with usinh hardcode passing Date String format to call Store Procedure
  5. Error failed with status code 500. RequestError: Conversion failed when converting date and/or time from character string.

    Current Behavior

    Can not passing Date parameter to native SQL execute method image

Expected Behavior

It should work with passing Date Object as Params https://loopback.io/doc/en/lb4/LoopBack-types.html I have curious about Datatype in Loopback4 can I using vanila Date object on SQL Params ? Or does it require Loopback Special Date Type ?

wdrdres3qew5ts21 commented 3 years ago

Fixed !!! You may need to using "-" Dash instead of "/" slash ! When I change from slash to dash it working :)