Format availibility to post

This commit is contained in:
2020-08-27 14:51:58 +02:00
parent 850921eb25
commit 714a631896
4 changed files with 48 additions and 14 deletions

View File

@@ -0,0 +1,18 @@
import { DateTime } from 'luxon';
const dtToUTC = (datetime, timezone) => {
// Create a date object with the selected timezone
const dt = DateTime.fromObject({
year: datetime.getFullYear(),
month: datetime.getMonth(),
day: datetime.getDate(),
hour: datetime.getHours(),
minute: datetime.getMinutes(),
zone: timezone,
});
// Convert and return a UTC Timestamp
return dt.toUTC().toISO();
};
export default dtToUTC;