Skip to content

Best practices NodeJS

  1. Do not use try /catch in a transaction unless you throw the error. Everything you did inside the same transaction is visible to later commands inside the same transaction. Just not to other transactions until committed. This is true for all isolation levels except Read uncommitted where “dirty reads” are possible
  2. Only store UTC format in DateTime. UTC is not a format and refers to “Coordinated Universal Time” This is a fixed clock at the prime meridian, equivalent to GMT for all practical purposes. It does not change for “daylight savings time” or “summer time”, and it is where we place the zero when talking about offsets of other time zones.
    The ISO8601 standard defines several formats, but the one most commonly used is also defined in RFC3339 .When you have a string value that includes a Z or +00:00 at the end, you know that it represents time at UTC, and can be stored in a DateTime.
    If you have some other offset, such as +01:00 or -04:00, then you should be storing these in a DateTimeOffset object instead. If you try to store it in a DateTime, then you have to choose whether you are going to ignore the offset, or apply it and store the time as UTC.
Published inUncategorized

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *