Hi team,
I'd like to extend data types support for UTC dates, i.e. Timestamp Athena type. My proposal is to create a new option, e.g. useUtcDates, to cast values of columns with type Timestamp to Date Javascript objects. This setting would have a default value of false. The caveat of this setting is that it will use machine-local time, thus this setting is intended for systems configured in UTC. This could be extended to Date Type but it would transform dates into date and times, e.g. '2020-11-18' would become '2020-11-18T00:00:00Z'. I intentionally avoid casting timestamp with time zone Athena type to reduce complexity.
For applications that deal with dates, converting Timestamp columns to Date objects is a common task given that many libraries expect Date objects. Moreover, athena-express hides the type in the result set. This forces developers that wish to operate using dates to access the column by name and explicitly convert values to Date objects.
I'd be willing to submit a patch if this feature request is approved.
Proposed update to documentation:
- useUtcDates | boolean | (default false) | Cast
Timestamp types to Javascript Date objects with times in UTC. Set this option if your code runs in machines configured with UTC as their timezone. Useful when your Timestamp columns are representing UTC date and time and you want to work with Date objects instead of String objects
Hi team,
I'd like to extend data types support for UTC dates, i.e.
TimestampAthena type. My proposal is to create a new option, e.g.useUtcDates, to cast values of columns with typeTimestamptoDateJavascript objects. This setting would have a default value offalse. The caveat of this setting is that it will use machine-local time, thus this setting is intended for systems configured in UTC. This could be extended toDateType but it would transform dates into date and times, e.g. '2020-11-18' would become '2020-11-18T00:00:00Z'. I intentionally avoid castingtimestamp with time zoneAthena type to reduce complexity.For applications that deal with dates, converting
Timestampcolumns toDateobjects is a common task given that many libraries expectDateobjects. Moreover, athena-express hides the type in the result set. This forces developers that wish to operate using dates to access the column by name and explicitly convert values toDateobjects.I'd be willing to submit a patch if this feature request is approved.
Proposed update to documentation:
Timestamptypes to JavascriptDateobjects with times in UTC. Set this option if your code runs in machines configured with UTC as their timezone. Useful when yourTimestampcolumns are representing UTC date and time and you want to work withDateobjects instead ofStringobjects