mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 09:36:17 +08:00
init: the first public commit for AFFiNE
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Get the current time in ISO format, the return value example is 2021-11-17T15:45:56, the return value can be directly used to create a Date object
|
||||
*/
|
||||
export function getDateIsoStringWithTimezone(dateMilliseconds?: number) {
|
||||
if (dateMilliseconds === undefined || dateMilliseconds === null) {
|
||||
dateMilliseconds = Date.now();
|
||||
}
|
||||
//offset in milliseconds
|
||||
const timezoneOffset = new Date().getTimezoneOffset() * 60000;
|
||||
const date_iso_string = new Date(
|
||||
dateMilliseconds - timezoneOffset
|
||||
).toISOString();
|
||||
return date_iso_string.slice(0, -5);
|
||||
}
|
||||
Reference in New Issue
Block a user