Skip to content

Notification Timestamp options not work propery #121

@cupsos

Description

@cupsos

Bug

Windows notification timestamp is always January 1. (probably 1970-01-01)

notification-tiemstamp

Environment

Windows 11 22H2 Microsoft Edge 108.0.1462.54

Bug reason

HTML5 Notification.timestamp is number format.

From Spec

A notification has an associated timestamp which is an EpochTimeStamp representing the time.

From MDN

A number representing a timestamp, given as Unix time in milliseconds.

But this library pass timestamp as string format. ISO 8601

public DateTime Timestamp { get; set; } = DateTime.UtcNow;

public async ValueTask<Guid> ShowsAsync(HtmlNotificationOptions notificationOptions)
{
var module = await _moduleTask.Value;
var id = Guid.NewGuid();
var info = new HtmlNotificationEventInfo(id,
notificationOptions.OnOpenCallback,
notificationOptions.OnClickCallback,
notificationOptions.OnCloseCallback,
notificationOptions.OnErrorCallback);
var dotnetRef = DotNetObjectReference.Create<HtmlNotificationEventInfo>(info);
_dotNetObjectReferences.Add(dotnetRef);
await module.InvokeVoidAsync("showSimple", id.ToString(), notificationOptions, dotnetRef);
return id;
}

//Instance methods
export function showSimple(id, options, dotnetRef) {
if (!id || !options) {
return;
}
let notification = new Notification(options.title, options);
if (dotnetRef) {
notification.onshow = (event) => { dotnetRef.invokeMethodAsync("OnOpen"); };
notification.onclose = (event) => { dotnetRef.invokeMethodAsync("OnClose"); };
notification.onerror = (event) => { dotnetRef.invokeMethodAsync("OnError"); };
notification.onclick = (event) => { dotnetRef.invokeMethodAsync("OnClick"); };
}
return notification;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions