Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/js_interop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: package:js_interop
permissions: read-all

on:
# Run CI on pushes to the main branch and on PRs.
push:
branches: [ main ]
paths:
- '.github/workflows/js_interop.yaml'
- 'js_interop/**'
pull_request:
paths:
- '.github/workflows/js_interop.yaml'
- 'js_interop/**'
schedule:
- cron: "0 0 * * 0"

defaults:
run:
working-directory: js_interop/

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [3.9, beta, dev]
test_config: ['-p chrome', '-p chrome -c dart2wasm', '-p node']

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: ${{ matrix.sdk }}

- run: dart pub get
- run: dart format --output=none --set-exit-if-changed .
if: ${{ matrix.sdk == 'dev' }}
- run: dart analyze --fatal-infos
- run: dart test ${{ matrix.test_config }}
1 change: 1 addition & 0 deletions js_interop/dart_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
platforms: [chrome, node]
6 changes: 6 additions & 0 deletions js_interop/lib/js_interop.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

export 'src/dart/date_time.dart';
export 'src/date.dart';
10 changes: 10 additions & 0 deletions js_interop/lib/src/dart/date_time.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import '../date.dart';

extension DateTimeToJSDate on DateTime {
/// Converts this to a [JSDate] that represents the same instant in time.
JSDate get toJS => JSDate.fromMillisecondsSinceEpoch(millisecondsSinceEpoch);
}
Loading