Browse Source

fix: WEEKDAY logic for sqlite

pull/2706/head
Wing-Kam Wong 2 years ago
parent
commit
bc5647eaaf
  1. 4
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/sqlite.ts

4
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/sqlite.ts

@ -81,9 +81,9 @@ const sqlite3 = {
// strftime('%w', date) - day of week 0 - 6 with Sunday == 0
// WEEKDAY() returns an index from 0 to 6 for Monday to Sunday
return knex.raw(
`strftime('%w', ${fn(pt.arguments[0])}, 'weekday ${getWeekdayByText(
`(strftime('%w', ${fn(pt.arguments[0])}) - 1 - ${getWeekdayByText(
pt?.arguments[1]?.value
)}')${colAlias}`
)} % 7 + 7) % 7 ${colAlias}`
);
},
};

Loading…
Cancel
Save