Public
Script
1
2
3
4
5
6
7
8
// SPDX-License-Identifier: 0BSD
const COCOA_REF_DATE = new Date(Date.UTC(2001, 0, 1, 0, 0, 0, 0));
// @see: https://developer.apple.com/documentation/corefoundation/1542812-cfdategetabsolutetime#discussion
export function toDate(cocoaTimestamp: number) {
return new Date(COCOA_REF_DATE.getTime() + cocoaTimestamp * 1000);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
March 6, 2024