-
-
Notifications
You must be signed in to change notification settings - Fork 61
Description
Bug
Windows notification timestamp is always January 1. (probably 1970-01-01)
Environment
Windows 11 22H2 Microsoft Edge 108.0.1462.54
Bug reason
HTML5 Notification.timestamp is number format.
A notification has an associated timestamp which is an EpochTimeStamp representing the time.
A number representing a timestamp, given as Unix time in milliseconds.
But this library pass timestamp as string format. ISO 8601
blazor-components/src/Majorsoft.Blazor.Components.Notifications/HTML5/HtmlNotificationData.cs
Line 74 in 879e425
public DateTime Timestamp { get; set; } = DateTime.UtcNow; |
blazor-components/src/Majorsoft.Blazor.Components.Notifications/HTML5/HtmlNotificationService.cs
Lines 61 to 77 in 879e425
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; | |
} |
blazor-components/src/Majorsoft.Blazor.Components.Notifications/wwwroot/notification.js
Lines 37 to 53 in 879e425
//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; | |
} |