guisturdy / dayjs-plugin-utc Goto Github PK
View Code? Open in Web Editor NEWa plugin for dayjs gives dayjs the ability to operate UTC timezone
a plugin for dayjs gives dayjs the ability to operate UTC timezone
Tried adding a year to a dayjs
instance extended with this plugin, and it breaks, I went ahead, forked, cloned and added a test for this project and was able to reproduce:
it('add years to current date', () => {
const addingYears = dayjs().add(1, 'y');
expect(addingYears.year()).toBe(dayjs().year() + 1);
})
Hi,
I'm trying to use this in my typescript project, but there are no type definitions.
Thanks.
https://momentjs.com/docs/#/displaying/as-iso-string/
Dayjs don't support the keepOffset
, maybe it can be done with this plugin.
Hi,
Thank you for creating this plugin, but I found some issue with .startOf
.
const b = dayjs.utc('2010-2-2 12:0:0').utcOffset(-450)
b.format('YYYY-MM-DD HH:mm')
// "2010-02-02 04:30"
b.hour()
// 4
b.startOf('hour').hour()
// 20 -> should be 4
b.startOf('hour').format('YYYY-MM-DD HH:mm')
// "2010-02-02 20:00" -> should be // "2010-02-02 04:00"
b.startOf('minute').format('YYYY-MM-DD HH:mm')
// "2010-02-02 20:00" -> should be // "2010-02-02 04:00"
b.startOf('minute').utcOffset(-450).format('YYYY-MM-DD HH:mm')
// "2010-02-02 04:30" -> works well if added `.utcOffset` again
Hello,
would it be possible to provide a license file, like this one: https://choosealicense.com/licenses/mit/.
Thank you!
Daylight Savings Time seems to be an issue in the plugin.
let utcDate = dayjs("2016-11-18:00:00:00+00:00");
console.log(utcDate.utc().format()); // 2016-11-17T23:00:00+00:00
I'd expect 2016-11-18T00:00:00+00:00
to be the value returned.
I found that dates including and between 11/7 - 3/13 have this problem.
Or am I just missing something? (My local offset is -7, observing DST currently.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.