Skip to content

Commit 787b64c

Browse files
committed
Add DateTimeToJSDate
1 parent 8955e52 commit 787b64c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

js_interop/lib/js_interop.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
export 'src/dart/date_time.dart';
56
export 'src/date.dart';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import '../date.dart';
6+
7+
extension DateTimeToJSDate on DateTime {
8+
/// Converts this to a [JSDate] that represents the same instant in time.
9+
JSDate get toJS => JSDate.fromMillisecondsSinceEpoch(millisecondsSinceEpoch);
10+
}

0 commit comments

Comments
 (0)