Files
blogger-nodejs/functions.js
2025-07-22 00:17:00 +01:00

11 lines
459 B
JavaScript

// The configuration defines a date format using the date-fns (a datetime library) syntax
// eg "yyyy-MM-dd"
// this converts unix time (an integer) into a string that is formatted according to config.js
// uses date-fns's fromUnixTime() and format() functions
// returns the formatted date (string)
export function unix_time_to_date_format(unix_time, format) {
date = fromUnixTime(unix_time)
formatted_date = format(date, format)
return formatted_date
}