0.0.3 • Published 3 years ago

mysql-tz v0.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

mysql-tz

entire package is:

type MySqlTz = () => string;

const mysqlTz: MySqlTz = () =>
  new Date()
    .toString()
    .split(" ")
    .reduce((a, b) => a.includes("-") || a.includes("+") ? a : b);

export default mysqlTz;

I made this because I found myself copying & pasting this function in many projects because it has proved useful.

import mariadb, { PoolConnection } from "mariadb";
import mysqlTz from "mysql-tz";

const maria_pool = mariadb.createPool({
  database: "SomeDatabase",
  user: 'username',
  password: 'password',
  timezone: mysqlTz(),
  connectionLimit: 25
});