You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm surprised you find that solves this issue @fontzter as the issue is with the module not casting the string to a DateTime object (therefore the required methods are missing).
Are you sure it's this issue you are solving with that?
Yes, @agarstang it works. What I meant is that you pass/use a VarChar in your query/proc instead of a DateTime, so it never needs to be converted. SQL does the conversion when it processes the query; and, as long as the varchar string holding the date is formatted in an acceptable way, the implicit conversion works fine. So, something like this works for me...
new sql.Request()
.input('an_id', sql.Int, some_js_id)
.input('a_js_date_formated_as_a_string', sql.VarChar, dateFormat(a_js_date_object, 'yyyy-mm-dd HH:MM:ss'))
.query(`update some_table
set an_actual_sql_DateTime_field = @a_js_date_formated_as_a_string
where the_id = @an_id`
).then(...
Activity
agarstang commentedon Jun 19, 2017
Also getting this on version 4.0.4.
asage-me commentedon Aug 22, 2017
As stated above, the fix is simple. Please change the if statement on line 300 to
agarstang commentedon Aug 24, 2017
This looks like it needs to be on the tedious project.
Replicated this issue and linked.
fontzter commentedon Nov 9, 2017
A hack workaround that I used, which doesn't require changing the source.
Using the npm dateformat package ...
.input('date_field', sql.VarChar, dateFormat(req.payload.js_date, 'yyyy-mm-dd HH:MM:ss'))IOW, send in the date as a varchar formatted as MSSQL likes it.
Hth
agarstang commentedon Nov 10, 2017
I'm surprised you find that solves this issue @fontzter as the issue is with the module not casting the string to a DateTime object (therefore the required methods are missing).
Are you sure it's this issue you are solving with that?
What version of the module are you using?
fontzter commentedon Nov 10, 2017
Yes, @agarstang it works. What I meant is that you pass/use a VarChar in your query/proc instead of a DateTime, so it never needs to be converted. SQL does the conversion when it processes the query; and, as long as the varchar string holding the date is formatted in an acceptable way, the implicit conversion works fine. So, something like this works for me...
I'm using 4.1.0
dhensby commentedon Feb 7, 2019
I'm closing this as it's a tedious issue, but also I'd welcome any PRs to work around this problem